Backendless Support

How can I assign a custom role to a user in code based on some additional criteria?

Assigning a role to a user can be done with a special API. The API is available for Java and REST clients and must be executed in the Backendless custom business logic. For example, in order to assign a role to a user account during the user registration process, you would need to do the following:

  1. Create an API event handler using Backendless console. See how to generate event handler code using console. The event handler you need to create is one for the User service ("after" Register event).
  2. In the event handler code implement the logic checking if a role should be assigned to the new user and use the API to assign a role to a user. Scroll down to the "Assign a role to a user" section.
  3. Compile and deploy your custom event handler as described in the documentation.
Is article helpful?