forked from cloudbees/jenkins-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
auth-project-report.groovy
41 lines (34 loc) · 1.1 KB
/
auth-project-report.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
for (item in Jenkins.instance.allItems) {
if (item.class.canonicalName == "com.cloudbees.hudson.plugins.folder.Folder") {
println "folder [" + item.fullName + "]"
item.properties.each { p ->
if(p.class.canonicalName == "com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty") {
p.getGrantedPermissions().each { gp ->
println " " + gp
}
}
}
println ""
} else {
print "item [" + item.fullName + "]"
try {
def p = item.getProperty(hudson.security.AuthorizationMatrixProperty.class)
if (p != null) {
println ""
p.getGrantedPermissions().each { gp ->
println " " + gp
}
}
}catch (err) {
println " folder -> " + item.class.canonicalName
item.properties.each { p ->
if(p.class.canonicalName == "com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty") {
p.getGrantedPermissions().each { gp ->
println " " + gp
}
}
}
}
println ""
}
}