Unassigning a Role from a User¶
Users may have different roles, and in some cases you may want to unassign a specific role from the user by invoking the operation described in this topic.
This operation is available only from Custom Business Logic. Applications must use the "CloudCode API key" in order for the API call to be accepted on the server. The reason for this restriction is that a malicious use of this API can easily compromise application's security. As a result, this API must be used from a controlled environment.
The following errors may occur during the API calls described above. See the Error Handling section for details on how to retrieve the error code when the server returns an error.
||Version is disabled or provided wrong application info (application id or secret key)
||Could not find role.
||One of the required parameters (user identity or roleName) is null.
||Could not find user by id or identity.
||Could not assign role to user.
||Could not unassign role to user.
CloudCode Codeless Reference¶
||A value for a column in the
||The name of the role to be unassigned from the specified identity.|
This Codeless block is only available in CloudCode due to the security reasons. If this operation is exposed to users, then your application can be compromised.
This operation does not return a value.
Consider the following record in the
Users data table:
Suppose, the identity
"firstname.lastname@example.org" has the following assigned roles:
The example below unassigns the
"Team Leader" role from the
After the Codeless logic runs, the
"Team Leader" role gets unassigned: