Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 15cd837

Browse files
authored
Update SSRS.Report_Permissions.sql
1 parent e2d43c2 commit 15cd837

File tree

1 file changed

+13
-48
lines changed

1 file changed

+13
-48
lines changed

‎SSRS.Report_Permissions.sql‎

Lines changed: 13 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
|--------------------------------------------------------------------------------------------------
99
*/
1010

11-
DECLARE @HideNonAccessGroups AS BIT
12-
SET @HideNonAccessGroups = 0
13-
1411
:setvar _server "Server1"
1512
:setvar _user "***username***"
1613
:setvar _password "***password***"
@@ -21,6 +18,13 @@ USE [$(_database)];
2118
GO
2219

2320

21+
DECLARE @all_value AS VARCHAR(50)
22+
DECLARE @UserName AS VARCHAR(50)
23+
24+
SET @all_value = '<ALL>'
25+
SET @UserName = '<ALL>'
26+
27+
2428
;WITH
2529
catalog_type_description
2630
AS
@@ -45,23 +49,15 @@ AS
4549
( 'Images')
4650
, ( 'SharedDataSets')
4751
, ( 'Data Sources')
52+
, ( 'contents')
4853
, ( '')
4954
) tbl ([FolderName])
5055
)
5156
,
52-
reporting_role_names -- added roles to the report server
53-
AS
54-
(
55-
SELECT tbl.* FROM (VALUES
56-
( 'Browser Group', 'DL', 'GG')
57-
, ( 'Functional Owner', NULL, NULL)
58-
) tbl ([RoleName], [RoleNamePrefix], [RoleNamePrefixReplace])
59-
)
60-
,
6157
user_list
6258
AS
6359
(
64-
SELECT
60+
SELECT
6561
usr.UserID
6662
, usr.UserName
6763
, UserNameFormat =
@@ -72,51 +68,20 @@ AS
7268
FROM
7369
dbo.Users usr
7470
)
75-
,
76-
reporting_roles
77-
AS
78-
(
7971
SELECT
80-
cat.Name
72+
FolderName = cat.[Name]
73+
, FolderPath = cat.Path
8174
, rol.RoleName
82-
, UserNameFormat =
83-
CASE
84-
WHEN LEFT(usr.UserNameFormat, 2) = rpt.RoleNamePrefix THEN rpt.RoleNamePrefixReplace + SUBSTRING(usr.UserNameFormat, 3, LEN(usr.UserNameFormat))
85-
ELSE usr.UserNameFormat
86-
END
87-
, ReportingRoleName = rpt.RoleName
75+
, usr.UserNameFormat
8876
FROM
8977
dbo.[Catalog] cat
9078
INNER JOIN catalog_type_description tpd ON cat.[Type] = tpd.TypeID
9179
LEFT JOIN dbo.PolicyUserRole urol ON urol.PolicyID = cat.PolicyID
9280
LEFT JOIN dbo.Roles rol ON urol.RoleID = rol.RoleID
93-
LEFT JOIN reporting_role_names rpt ON rpt.RoleName = rol.RoleName
9481
LEFT JOIN dbo.Policies pol ON urol.PolicyID = pol.PolicyID
9582
LEFT JOIN user_list usr ON urol.UserID = usr.UserID
9683
LEFT JOIN nonreport_folders nrf ON nrf.FolderName = cat.Name
9784
WHERE
9885
1=1
9986
AND nrf.FolderName IS NULL
100-
)
101-
SELECT DISTINCT
102-
FolderName = rpt.Name
103-
, rpt.RoleName
104-
, UserNameFormat = STUFF((SELECT '; ' + rol.UserNameFormat FROM reporting_roles rol WHERE rol.RoleName = rpt.RoleName AND rol.Name = rpt.Name FOR XML PATH('')),1,1,'')
105-
, ReportingRoleName
106-
FROM
107-
reporting_roles rpt
108-
WHERE
109-
1=1
110-
AND (
111-
CASE
112-
WHEN @HideNonAccessGroups = 0 THEN 1
113-
ELSE 2
114-
END
115-
)
116-
<=
117-
(
118-
CASE
119-
WHEN ISNULL(ReportingRoleName, '') = '' THEN 1
120-
ELSE 2
121-
END
122-
)
87+
AND (@all_value IN(@UserName) OR usr.UserNameFormat IN(@UserName))

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /