Skip to content

Enable/Disable User

The Users table is where registered users are stored in Backendless. The table has a special, system-level column called userStatus:

userstatus-column

As you can see in the screenshot above, the user accounts may have one of the following three statuses:

  • ENABLED - user can login into the app.
  • DISABLED - user cannot login into the app.
  • EMAIL_CONFIRMATION_PENDING - this is an intermediary state of a user account until they confirm their email address by clicking a link in the email message sent to them. Users in this status cannot login. When a user confirms their email address, Backendless automatically changes this status to ENABLED. For more information about email confirmations, see the User Registration section of this guide.

It is possible to change user status programmatically using the API described below. The APIs can be used only from cloud code implemented in either Java, JS or Codeless. This restriction is in place to make sure the security of your app is not compromised. The API allows the following status transitions:

From
To
ENABLED
DISABLED
DISABLED
ENABLED
EMAIL_CONFIRMATION_PENDING
ENABLED
EMAIL_CONFIRMATION_PENDING
DISABLED
// ENABLE USER
Future<void> Backendless.userService.enableUser( userObjectId );

// DISABLE USER
Future<void> Backendless.userService.disableUser( userObjectId );

where:

Argument                Description
userObjectId objectId value of the user account to be either enabled or disabled.