Click HERE to see how Saviynt Intelligence is transforming the industry. |
09/24/2024 01:45 AM
Hi Team,
Need a query for all the active users having specific role like 'XXX' assigned and for a particular endpoint like 'ZZZ' along with entitlement value and the account name.
Thanks,
Sharanya V
09/24/2024 09:42 AM
share your draft query
09/24/2024 09:42 AM
SELECT
u.USERNAME,
e.endpointname,
a.name AS accountname,
r.role_name AS rolename,
e.entitlement_value
FROM
users u
JOIN
user_roles ur ON u.userkey = ur.userkey
JOIN
roles r ON ur.rolekey = r.rolekey
JOIN
user_accounts ua ON u.userkey = ua.userkey
JOIN
accounts a ON ua.accountkey = a.accountkey
JOIN
endpoints e ON a.endpointkey = e.endpointkey
WHERE
r.role_name = 'XXX'
AND e.endpointname = 'ZZZ'
AND u.statuskey =1
ORDER BY
u.USERNAME;
09/25/2024 12:29 AM
Hi @rushikeshvartak ,
The above query which you have shared is using user_roles tables , but there is no user_roles table and the query is not giving the results.
Thanks,
Sharanya V
09/25/2024 08:05 AM - edited 09/25/2024 08:05 AM
SELECT U.USERNAME,
E.ENDPOINTNAME,
A.NAME AS accountname,
R.ROLE_NAME AS rolename,
EV.ENTITLEMENT_VALUE AS entitlementvalue
FROM USERS U
JOIN ROLE_USER_ACCOUNT UR
ON U.USERKEY = UR.USERKEY
JOIN ROLES R
ON UR.ROLEKEY = R.ROLEKEY
JOIN USER_ACCOUNTS UA
ON U.USERKEY = UA.USERKEY
JOIN ACCOUNTS A
ON UA.ACCOUNTKEY = A.ACCOUNTKEY
JOIN ENDPOINTS E
ON A.ENDPOINTKEY = E.ENDPOINTKEY
LEFT JOIN ROLE_ENTITLEMENTS RE
ON R.ROLEKEY = RE.ROLEKEY
LEFT JOIN ENTITLEMENT_VALUES EV
ON RE.ENTITLEMENT_VALUEKEY = EV.ENTITLEMENT_VALUEKEY
WHERE R.ROLE_NAME = 'XXX'
AND E.ENDPOINTNAME = 'ZZZ'
AND U.STATUSKEY = 1
ORDER BY U.USERNAME;