Skip to main content

Users.AssignRoleAsync

Description

The API assigns the role ID to the specified user ID of the user inside the connected Control Room.

Signature [C#]

Task AssignRoleAsync(int userId, int roleId)

Properties

Input

PropertyDescription
userIdSpecify the user ID to assign the specified role.
roleIdSpecify the role ID to be assigned to a user.

Remarks

Use AssignRoleAsync API to assign a role to the specified user ID inside the connected Control Room.

Example

C#
public void AssignRole()
{
IControlRoomContext context = LoginControlRoom();

int userId = 1;
int roleId = 1;

Task.Run(() => context.Users.AssignRoleAsync(userId, roleId)).Wait();
}
C#
public IControlRoomContext LoginControlRoom()
{
IControlRoomContext context;
string connectionString;

connectionString = "ServerUrl=https://demo.onnitellibuddies.com;UserName=demoadmin;Password=password";
context = new ControlRoomContext(connectionString);

context.Open();
return context;
}