Assigning a Role to a User¶
Description¶
This operation assigns a new role to a user.
This functionality can be used only in CloudCode (Java, JS or Codeless), 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. For information about the API select either Android/Java or JS documentation.
CloudCode Codeless Reference¶
where:
Argument | Description |
---|---|
identity |
A value for a column in the Users table marked as identity. By default the column marked as identity isemail , however, it can be changed to another column in Backendless Console. |
role name |
The name of а role that must be assigned. |
Important
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 "alice@yourmail.com"
has the following assigned roles:
The example below assigns a new role "Team Leader"
to the "alice@yourmail.com"
identity.
The result of this operation is a new assigned role "Team Leader"
: