# Manage Roles
This module is used to manage Authing roles, and can perform operations such as adding, deleting, modifying, and checking roles, adding/deleting users, and adding/deleting roles.
# Creating a Role
RolesManagementClient().create(code, description)
Create role
# Parameters
code
<string> unique character identifierdescription
<string> description
# Example
var code = "code";
var role = await managementClient.Roles.Create(code, "test role");
# Delete role
RolesManagementClient().delete(code)
Delete role
# Parameters
code
<string> unique character identifier
# Example
var code = "code";
var message = await managementClient.Roles.Delete(code);
# Delete roles in batch
RolesManagementClient().deleteMany(codeList)
Batch delete roles
# Parameters
codeList
<string[]> Character unique identifier list
# Example
var code = "code";
var message = await managementClient.Roles.DeleteMany(new string[] {code });
# Modify role
RolesManagementClient().update(code, input)
Modify role
# Parameters
code
<string> unique character identifierinput
<Object>input.description
<string> description informationinput.newCode
<string> New unique identifier
# Example
var code = "code";
var desc = "update desc";
var role = await managementClient.Roles.Update(code, desc);
# Get role details
RolesManagementClient().detail(code)
Get role details
# Parameters
code
<string> unique character identifier
# Example
var code = "code";
var role = await managementClient.Roles.Detail(code);
# Get a list of roles
RolesManagementClient().list(page, limit)
Get a list of roles
# Parameters
page
<number> Page number The default value is:1
.limit
<number> Number per page The default value is10
.
# Example
var roles = await managementClient.Roles.List();
# Get the list of role users
RolesManagementClient().listUsers(code)
Get the list of role users
# Parameters
code
<string> unique character identifier
# Example
var code = "code";
var users = await managementClient.Roles.ListUsers(code);
# Add user
RolesManagementClient().addUsers(code, userIds)
Add user
# Parameters
code
<string> unique character identifieruserIds
<string[]> list of user IDs
# Example
var code = "code";
var users = new string[] {"userId" };
var message = await managementClient.Roles.AddUsers(code, users);
# Remove user
RolesManagementClient().removeUsers(code, userIds)
Remove user
# Parameters
code
<string> unique character identifieruserIds
<string[]> list of user IDs
# Example
var code = "code";
var users = new string[] {"userId" };
var message = await managementClient.Roles.RemoveUsers(code, users);
# Get a list of role policies
RolesManagementClient().listPolicies(code, page, limit)
Get a list of role policies
# Parameters
code
<string> unique character identifierpage
<number> Page number The default value is:1
.limit
<number> Number of page numbers The default value is10
.
# Example
var code = "code";
var policies = await managementClient.Roles.ListPolicies(code);
# Authorization Policy
RolesManagementClient().addPolicies(code, policies)
Grant role authorization strategy
# Parameters
code
<string> unique character identifierpolicies
<string[]> policy list
# Example
var code = "code";
var policies = new string[] {"policyId" };
var message = await managementClient.Roles.AddPolicies(code, policies);
# Role removal strategy
RolesManagementClient().removePolicies(code, policies)
Role removal strategy
# Parameters
code
<string> unique character identifierpolicies
<string[]> policy list
# Example
var code = "code";
var policies = new string[] {"policyId" };
var message = await managementClient.Roles.RemovePolicies(code, policies);