GRANT ROLE¶
GRANT ROLE assigns one or more custom roles to a user in the current service group. A user can have up to 16 custom roles.
Prerequisites¶
First connect to the Graph service. Run the command in a GQL client.
- To grant roles to a user, you must have
ADMINin the current service group. - The user that you want to grant roles to is already created and invited to the current service group. For more information, see Create users and INVITE USER.
- The roles have been created with CREATE ROLE.
Limitations¶
The ADMIN role is exclusive to the service group owner and cannot be assigned by using GRANT ROLE.
Syntax¶
- grant_role_command
grant_role_command ::=
'GRANT' 'ROLE' role_name (',' role_name)* 'TO' 'USER' user_name
Parameters¶
role_name¶
The name of the role to be granted.
user_name¶
The username receiving the roles.
Examples¶
The example uses the existing role role1 and user user1, who has joined the service group.
GRANT ROLE role1 TO USER user1
Check user1's roles with SHOW ROLES FOR USER. The list should include role1. Its privileges combine with the user's existing privileges.