update_item_access
To give a user access rights to an item, use the user/update_item_access method.
svc=user/update_item_access¶ms={
"userId": <long>,
"itemId": <long>,
"accessMask": <long>
}
To send a request, you should have the Manage user’s access rights access right to the user and the Manage access to this object access right to the item.
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.
{}
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:
|