User Access 3 WG Levels
Generates a report of user access for three specific workgroup levels, showing which users have access to each level and their permissions.
Parameters
- None (or list any script parameters if present).
Notes
- Useful for reviewing user access and permissions for three defined workgroup levels.
- Ensure appropriate permissions to access user and workgroup data.
T-SQL
SET NOCOUNT ON
SET ANSI_WARNINGS OFF
;
With
User_Names
as
(
Select
FRIENDLYNAME,
UNIQUEID
From USERS
where FRIENDLYNAME not in ('ESSUSER','Default Setup Account','Default System Account','Default Service Account','ATM Service Account','ATM Service 2',
'ATM User','Auto Service Account','Employee Self Service Account','AoD Administrative Account','AoD Technicians Account','AoD Accounting Account','Technicians Account',
'Accounting Account','Sales #1 Account','Sales #2 Account','Sales #3 Account')
),
WG_Sets_Names
as
(
Select
ua.USERID as ID,
Case
when ua.WG1 = 0 then 'All'
else w1.NAME
end as WG1,
Case
when ua.WG2 = 0 then 'All'
else w2.NAME
end as WG2,
Case
when ua.WG3 = 0 then 'All'
else w3.NAME
end as WG3
FROM USERACCESS ua
left join WORKGROUP1 w1 on
ua.WG1 = w1.WGNUM
left join WORKGROUP2 w2 on
ua.WG2 = w2.WGNUM
left join WORKGROUP3 w3 on
ua.WG3 = w3.WGNUM
)
--Select * from WG_Sets
--Select * from WG_Sets_Names
--/*
Select UNIQUEID, FRIENDLYNAME, null, null, null/*,null,null,null,null*/
from User_Names
UNION
Select ws.ID, 'zzz', ws.WG1, ws.wg2, ws.WG3/*,ws.WG4,ws.WG5,ws.WG6,ws.WG7 */
from WG_Sets_Names WS, User_Names UN
where ws.ID = un.UNIQUEID
order by 1,2
--*/Content Inventory
- Doc File:
content/docs/reports/users_information/useraccess_3_wg_levels.mdx - SQL Script:
SQL/reports/users_information/useraccess_3_wg_levels.sql