Message:

Backendless Blog

Subscribe rss
Blog categories
All | Backendless features
Feature 45: Updating user account using User Service API
February 22, 2015 by markpiller

The use-case for updating a user account is rather frequent. Either the user herself or the admin may need to update user properties. Backendless provides the API for updating user accounts, although app admins/developers can do it using Backendless console as well. The code below demonstrates the API for updating a user:

Synchronous API (Plain Java only):

Asynchronous API (Plain Java and Android):

Notice the code logs in the user first. If the user is logged in, the user update operation is handled with the same security rules as updating any other data object by its owner (this will be reviewed in detail in a future post).

It is possible to update a user object without logging in as that user. Consider the following example:

Synchronous API (Plain Java):

Asynchronous API (Plain Java and Android):

The approach shown above requires knowing objectId of the user object. This operation can be easily restricted only for the specific users/roles using Backendless console:

  1. Login to Backendless console, select your app and click the Data icon.
  2. The Users table is selected by default. Click the Table Schema and Permissions button in the upper right corner.
  3. Click Role Permissions to grant the permission to update other user objects to a role.
  4. In my app I have the Administrator role. The screenshot below shows that I granted a permission to update user accounts to that role and denied it to all others:

 

 

 

Share this post
Tweet about this on TwitterShare on FacebookGoogle+