update_user_flags

To set user flags (additional properties), use the method user/update_user_flags:

Copied!
svc=user/update_user_flags&params={"userId":<long>,
				   "flags":<uint>,
				   "flagsMask":<uint>}

Parameters

The required parameters are marked with an asterisk (*).

Name Description
userId* User ID.
flags* Setting flags. See below.
flagsMask* Mask which determines what bits will be changed.

The user setting flags are as follows:

Value Description
0x01 User disabled.
0x02 Can’t change password.
0x04 Can create items.
0x10 Can’t change settings.
0x20 Can send SMS.
0x40 Administrator. This flag can’t be changed with this method, but it can be returned in the fl field of the response.

Example of using the mask and flags

We need to allow a user to change their password (0x02), forbid to change the settings (0x10), and leave all the other flags without changes. In this case, the mask will be 0x2+0x10=0x12. The flag 0x02 must be removed, and the flag 0x10 must be set, therefore, the parameter flag will be 0x10.

Response

Copied!
{
	"fl":<uint>	/* flags */
}

Error codes

Error code Description
4 Incorrect parameters provided.
6 Failed to update flags.
7 One of the following errors:
  • The user wasn’t found, or you have no Change user’s general properties access right to the user.
  • Failed to fetch the user’s creator.
  • The flagsMask parameter contains flags that can’t be changed. Only the 0x01, 0x02, 0x04, 0x10, and 0x20 flags can be changed. The 0x04 and 0x20 flags can be changed only if the creator of the user has them.

If you find a mistake in the text, please select it and press Ctrl+Enter.