demellor | Posts: 46

Set User Roles in Subaccount

0 votes

We have been able to use the Bulk Invite Sender Tool to bulk provision users.  Is there a way once someone is created in OneSpan that I can programmatically assign their role within a subaccount.


Approved Answer
Duo_Liang | Posts: 3776

Reply to: Set User Roles in Subaccount

0 votes

Hi Richard,

 

After some tests, I believe this method is introduced in .NET SDK 11.45 (The latest version is 11.49). Hence I believe you will either upgrade your SDK version, or implement the function in RESTful code.

 

Duo


Duo_Liang | Posts: 3776

Reply to: Set User Roles in Subaccount

0 votes

Hi Richard,

 

You can use below SDK method to assign account role to a sender:

            ossClient.AccountService.assignAccountRoleToUser("0bbYsyszx2cB", UserAccountRoleBuilder.NewUserAccountRole()
                .WithAccountId("sdkVZdIcvj0I")
                .WithAccountRoles(new List<AccountRole> {
                new AccountRole(){Id="member"},
                new AccountRole(){Id="0c2cb422-f441-461e-a48f-64eb93369acb"} 
            }).Build());

 

Note that "0bbYsyszx2cB" is the sender ID, "sdkVZdIcvj0I" is the account/subaccount ID, and the "Id" is the minimal required field for AccountRole.

 

The API behind the scene is:

HTTP Request

POST /api/account/senders/{senderId}/roles                                               ----without subaccount

POST /api/account/senders/{senderId}/account/{accountId}/roles              ----with subaccount

HTTP Headers

Authorization: Basic {your_api_key}

Content-Type: application/json

Accept: application/json

Example Payload

[ { "id": "owner" }, { "id": "member" }, { "id": "manager" }, { "id": "dc996466-8a0a-40d2-a9fb-461de2c2fab7" } ]

 

 

Duo


demellor | Posts: 46

Reply to: Set User Roles in Subaccount

0 votes

I attempted to use the code but assignAccountRoleToUser doesn't appear to exist within the .NET library v11.34.1.0

 


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off