We have a requirement where there are some Security Context Values in ARS which the user can select. A user can select 1,2,3, or more Security Context Values.
Now, in order to assign this Security Context Value to the user we are calling an API in the Add access JSON.
The API will only accept a single Security Context Value at a time. So, in order to assign all the Context Values we need to call the same API 'n' number of times(where n is the number of Security Context Values selected by the user in ARS).
Is there a way to use looping in the Add Access JSON?.
{
"type": "multiCall",
"call": [
// Call to add access here...
// Remaining below calls are for Security Context and Context Value assignment...
{
"name": "Role",
"connection": "acctAuth",
"url": "https://<url>/rs/v1/fusion/users/datasecurity",
"httpMethod": "POST",
"httpParams": "{\"SecurityContext\":\"${requestAccessAttributes.get('SecurityContext')}\",\"SecurityContextValue\":\"${(requestAccessAttributes.get('SecurityContextValue')).split(\",\")[0]}\", \"RoleNameCr\":\"${entitlementValue.entitlement_value}\",\"UserName\":\"${user.username}\"}}",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate, br"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204
]
}
},
{
"name": "Role",
"connection": "${if((requestAccessAttributes.get('SecurityContextValue')).split(\",\").length>1) {'acctAuth'} else {''}}",
"url": "https://<url>/rs/v1/fusion/users/datasecurity",
"httpMethod": "POST",
"httpParams": "{\"SecurityContext\":\"${requestAccessAttributes.get('SecurityContext')}\",\"SecurityContextValue\":\"${(requestAccessAttributes.get('SecurityContextValue')).split(\",\")[1].trim()}\", \"RoleNameCr\":\"${entitlementValue.entitlement_value}\",\"UserName\":\"${user.username}\"}}",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate, br"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204
]
}
},
{
"name": "Role",
"connection": "${if((requestAccessAttributes.get('SecurityContextValue')).split(\",\").length>2) {'acctAuth'} else {''}}",
"url": "https://<url>/rs/v1/fusion/users/datasecurity",
"httpMethod": "POST",
"httpParams": "{\"SecurityContext\":\"${requestAccessAttributes.get('SecurityContext')}\",\"SecurityContextValue\":\"${(requestAccessAttributes.get('SecurityContextValue')).split(\",\")[2].trim()}\", \"RoleNameCr\":\"${entitlementValue.entitlement_value}\",\"UserName\":\"${user.username}\"}}",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate, br"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204
]
}
},
.....and so on....
]
}
The problem with above approach is that we have more than 40 Security Context Values for each Security Context. So, if we use this approach we need to call the same datasecurity API more than 40 times...
Is there a more cleaner and better way to achieve this?. If we could use looping it would solve this concern.
Please guide.
Thanks,
Atul Singh