update_item_access

To give a user access rights to an item, use the user/update_item_access method.

Copied!
svc=user/update_item_access&params={
    "userId": <long>,
    "itemId": <long>,
    "accessMask": <long>
}

The saved mask contains only the access rights that the current user has to the item: bits that the current user doesn’t have are dropped. The method doesn’t add dependent access rights. For example, when you select the Edit tasks access right in the monitoring system, the Edit task status and manage comments access right is selected automatically, but this method saves only the bits passed in accessMask.

When the access rights are updated, an update_access record is added to the log of the item and to the log of the user. In the log of the item, the p1 parameter contains the new mask and the previous mask separated by a comma, and p2 contains the name of the user.

Parameters

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

Name Description
userId* User ID.
itemId* Item ID.
accessMask* Access mask. For the flags, see Access flags.

Response

If the request is completed successfully, an empty object is returned.

Copied!
{}

If the request fails, an error code is returned.

Error codes

Error code Description
4 Wrong input parameters.
6 Failed to update access to the item.
7 One of the following errors:
  • The user or the item isn’t found.
  • You have no Manage user’s access rights access right to the user or no Manage access to this object access right to the item.
  • The resulting mask is 0, and the user is the creator of the item or is higher in the hierarchy than the creator.

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