Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Use loop in Add Access Json

AS5278
Regular Contributor II
Regular Contributor II

Hi,

 

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?.

Currently we are making duplicate calls like below:

{
    "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
xurde
4 REPLIES 4

SB
Saviynt Employee
Saviynt Employee

Let me check on this and will update you.


Regards,
Sahil

rushikeshvartak
All-Star
All-Star

You can’t loop. You need to duplicate same call again


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

SB
Saviynt Employee
Saviynt Employee

As @rushikeshvartak mentioned, you cannot loop but will need to duplicate the call.


Regards,
Sahil

AS5278
Regular Contributor II
Regular Contributor II

@SB We have achieved it by duplicating the calls. But, being able to use loops inside JSONs would be a nice to have feature. I will create an idea in idea portal.

Thanks,

Atul Singh

xurde