client online state

This commit is contained in:
manuel.sowada
2026-05-12 07:57:32 +02:00
parent b34f912857
commit 0a28a3e493
17 changed files with 1210 additions and 788 deletions

View File

@@ -552,51 +552,16 @@ GO
CREATE OR ALTER VIEW dbo.vPermissionOverview AS
SELECT
p.ID AS Permission_ID,
p.Scope,
p.Resource,
p.Action,
p.Scope + '.' + p.Resource + '.' + p.Action AS PermissionKey,
r.ID AS Role_ID,
-- 🔥 NEU: Anzahl Rollen pro Permission
COUNT(r.ID) OVER (PARTITION BY p.ID) AS RoleCount,
COUNT(gr.Group_ObjectGUID) AS GroupCount,
COUNT(ar.Authentication_ObjectGUID) AS DirectUserCount,
COUNT(ag.Authentication_ObjectGUID) AS GroupUserCount,
COUNT(
COALESCE(ar.Authentication_ObjectGUID, ag.Authentication_ObjectGUID)
) AS TotalUserCount
FROM dbo.Permission AS p
INNER JOIN dbo.RolePermissions AS rp
ON rp.Permission_ID = p.ID
INNER JOIN dbo.Role AS r
ON r.ID = rp.Role_ID
LEFT JOIN dbo.GroupRoles AS gr
ON gr.Role_ID = r.ID
LEFT JOIN dbo.AuthenticationRoles AS ar
ON ar.Role_ID = r.ID
LEFT JOIN dbo.AuthenticationGroups AS ag
ON ag.Group_ObjectGUID = gr.Group_ObjectGUID
GROUP BY
p.ID,
p.Scope,
p.Resource,
p.Action,
r.ID,
r.Name;
SELECT p.ID AS Permission_ID, p.Scope, p.Resource, p.Action, p.Scope + '.' + p.Resource + '.' + p.Action AS PermissionKey, r.ID AS Role_ID, /* 🔥 NEU: Anzahl Rollen pro Permission*/ COUNT(r.ID) OVER (PARTITION BY p.ID)
AS RoleCount, COUNT(gr.Group_ObjectGUID) AS GroupCount, COUNT(ar.Authentication_ObjectGUID) AS DirectUserCount, COUNT(ag.Authentication_ObjectGUID) AS GroupUserCount,
COUNT(COALESCE (ar.Authentication_ObjectGUID, ag.Authentication_ObjectGUID)) AS TotalUserCount
FROM dbo.Permission AS p FULL JOIN
dbo.RolePermissions AS rp ON rp.Permission_ID = p.ID LEFT JOIN
dbo.Role AS r ON r.ID = rp.Role_ID LEFT JOIN
dbo.GroupRoles AS gr ON gr.Role_ID = r.ID LEFT JOIN
dbo.AuthenticationRoles AS ar ON ar.Role_ID = r.ID LEFT JOIN
dbo.AuthenticationGroups AS ag ON ag.Group_ObjectGUID = gr.Group_ObjectGUID
GROUP BY p.ID, p.Scope, p.Resource, p.Action, r.ID, r.Name;
GO