get_items_by_access

The user/get_items_by_access method returns the IDs of the items of the specified type to which a user has at least the specified access rights. It returns only a list of IDs, so it’s faster than user/get_items_access if you need to check the access rights of a user to many items.

Copied!
svc=user/get_items_by_access&params={
	"userId":<long>,
	"itemSuperclass":"<text>",
	"reqAccess":<long>
}

Parameters

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

Parameter Description
userId* User ID.
itemSuperclass* Item type, for example, avl_unit. For the list of types, see Item types. If you pass an empty string, items of all types are returned.
reqAccess* Required access rights: a mask of access flags. An item is returned only if the user has all the rights from the mask. For the flags, see Access flags. If the value is 0 or less, an empty list is returned.

The method checks only the items to which the user has access rights assigned directly. If the user has access to an item only through a group, for example, to a unit through a unit group, the item isn’t returned. To get the items available through groups as well, use user/get_items_access with directAccess set to false.

The response contains only the items to which the current user also has the rights from reqAccess, including the rights received through groups. The other items are excluded from the list without an error.

To get the items of another user, you need the Manage user’s access rights access right to this user. To get your own items, no access right to your user is required.

Response

Copied!
{
	"ids":[
		<long>,
		<long>,
		...
	]
}

Error codes

Error code Description
4 Invalid input parameters.
7 Failed to fetch the current user, or the user specified in the userId parameter isn’t found or you have no Manage user’s access rights access right to this user.

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