Viewing Agent Entities Using Security Stored Procedures

Stored Procedure

Sec_getIdaObjectsForUser.sp: Lists the agent entities that the user or user group has permissions on as part of a security association. This API lists one type of entity at a time. For example, use this API to list all of the clients a user is associated with.

Inputs

Name

Description

Required

userId

The user ID for the user. You can retrieve the user ID from the UMUsers table: SELECT id FROM UMUsers WHERE login = 'user_name'.

Yes

entityType

The type of entity. For example, set this to 6 to return all of the backup sets a user is associated with. The ID for each type of entity is available in the APP_Entity table.

Supported Entities: Client, agent (app type), instance, backup set, and subclient

Yes

permissionId

The permission ID for the permission. If you do not know the ID for a permission, you can find the permission name and ID in the UMPermissions table.

Valid values are:

  • 0, Lists the entities that the user or user group has any permission on.

  • permission ID, Lists the entities that the user or user group has the defined permission on.

Yes

inheritFromChildren

The option to return child entities.

Valid values are:

  • 0, Do not return child entities.

  • 1, Return child entities.

Yes

Output

The list of agent entity IDs that the user or user group has permissions on.

Sample Query

This query lists backup sets that user "u1" has any permissions on:

--sec_getIdaObjectsForUser.sp
 --If you want to get list of backupsets that a user called u1 can see.
 DECLARE @userId INT = (SELECT id FROM UMUsers WHERE login = 'u1')
 DECLARE @entityType INT = 6 --Backupset entity. You can get it from APP_Entity table.
 DECLARE @permissionID INT = 0 --Set it to 0 if you just want to check for associations. Set to corresponding permission if you want to check for particular permission.
 DECLARE @inheritFromChildren INT = 0 --Set it to 1 if you want to get parents if rights are present on childrent also. (i.e, if you want to get backupsets if rights are present on subclient then set it to 1).
 IF OBJECT_ID('tempdb.dbo.#getIdaObjectsExample') IS NOT NULL
   DROP TABLE #getIdaObjectsExample
 CREATE TABLE #getIdaObjectsExample (clientId INT, appTypeID INT, instanceId INT, backupsetID INT, subclientID INT)
 EXEC sec_getIdaObjectsForUser @userId, @entityTYpe, @permissionId, @inheritFromChildren, '#getIdaObjectsExample'
 SELECT * FROM #getIdaObjectsExample
×

Loading...