IRoleService AddUserToRoles Method (String,  String , String) CelloSaaS API Documentation
Assign many roles to the given user

Namespace: CelloSaaS.ServiceContracts.AccessControlManagement
Assembly: CelloSaaS.ServiceContracts (in CelloSaaS.ServiceContracts.dll) Version: 4.3.1.0 (4.3.1.0)
Syntax

void AddUserToRoles(
	string userIdentifier,
	string[] roleIdentifiers,
	string tenantId
)

Parameters

userIdentifier
Type: System String
The user identifier.
roleIdentifiers
Type:  System String 
The role identifiers.
tenantId
Type: System String
The tenant id.
Exceptions

ExceptionCondition
System ArgumentException
CelloSaaS.ServiceContracts.AccessControlManagement RoleExceptionIf db exception occurs
System UnauthorizedAccessExceptionIncase of privilege to add user roles
System ArgumentNullExceptionIf used id or tenant id or role ids is null or empty
Examples

public void AddUserToRoles()
{
string userIdentifier = "3398F837-B988-4708-999D-D3DFE11875B3";
string[] roleIdentifiers = new string[] {"GR$Tenant_Admin", "GR$Product_Admin"};
IRoleService roleService = ServiceLocator.Resolve>IRoleService<();
roleService.AddUserToRoles(userIdentifier, roleIdentifiers,UserIdentity.TenantID);
}
See Also