Stored Procedure
Sec_getNonIdaObjectsForThisUser.sp: Lists the 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 28 to return all of the client groups a user is associated with. The ID for each type of entity is available in the APP_Entity table. |
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:
|
Yes |
Output
The list of entity IDs that the user or user group has permissions on.
Sample Query
This query lists client groups that user "u1" has any permissions on:
--sec_getNonIdaObjectsForUser.sp
--If you want to get list of client groups that a user called u1 can see.
DECLARE @userId INT = (SELECT id FROM UMUsers WHERE login = 'u1')
DECLARE @entityType INT = 28 --Client group entity. You can get it from APP_Entity table.
DECLARE @permissionID INT = 0 --Set to 0 if you just want to check for associations. Set to corresponding permission if you want to check for a particular permission.
IF OBJECT_ID('tempdb.dbo.#getNonIdaObjectsExample') IS NOT NULL
DROP TABLE #getNonIdaObjectsExample
CREATE TABLE #getNonIdaObjectsExample (entityId INT)
EXEC sec_getNonIdaObjectsForThisUser @userId, @entityTYpe, @permissionId, '#getNonIdaObjectsExample'
SELECT * FROM #getNonIdaObjectsExample