Permissions

查看分配給每個使用者的角色(報表伺服器)

  • June 10, 2019

無論如何我可以列出在 ReportServer 數據庫的不同文件夾中分配給每個使用者的角色,並且在那個 SQL 語句中我應該能夠聲明類似於 @User_Name報告使用者的內容

從部落格中找到我的答案幾乎相似:) !!!

DECLARE @UserName VARCHAR(200) = 'UserName' 

SELECT Rol.RoleName,Us.UserName ,Cat.PATH,Cat.[Name] ReportName,
CASE Cat.Type WHEN 1 THEN 'Folder' WHEN 2 THEN 'Report' 
WHEN 3 THEN 'Resource' WHEN 4 THEN 'Linked Report' 
WHEN 3 THEN 'Data Source' ELSE '' END AS CatalogType
,Cat.Description 
FROM Catalog Cat     --Parent
INNER JOIN Policies Pol 
ON Cat.PolicyID = Pol.PolicyID
INNER JOIN PolicyUserRole PUR 
ON Pol.PolicyID = PUR.PolicyID 
INNER JOIN Users Us 
ON PUR.UserID = Us.UserID 
INNER JOIN Roles Rol 
ON PUR.RoleID = Rol.RoleID
WHERE   Cat.Type in (1,2)
AND  ( Us.UserName LIKE @UserName  )
ORDER BY Cat.PATH

引用自:https://dba.stackexchange.com/questions/84406