You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Better permission reporting and CSV file support for groovy examples (#270)
* Added CSV and permission details to PrintRepoAccess
* bumped library number
* introduced -c parameter to support reading repository names from CSV
files
* introduced -p parameter to print detailed permissions about user
access
* Added CSV file support for AuditUsers
* introduced -c option to read users from CSV file
* renamed skipPublicRepo option and made it opt-in
* use CSV file header for generated output
* Added extended permission reporting option
* added -e switch to split repositories based on access type
cli =newCliBuilder(usage: 'groovy AuditUsers.groovy [options] [user accounts]\nReports all repositories that can be accessed by given users')
24
25
cli.t(longOpt: 'token', 'personal access token of a GitHub Enterprise site admin with repo skope (or use GITHUB_TOKEN env variable)', required: false , args: 1 )
25
26
cli.u(longOpt: 'url', 'GitHub Enterprise URL (or use GITHUB_URL env variable), e.g. https://myghe.com', required: false , args: 1 )
26
-
cli.s(longOpt: 'skipPublicRepos', 'Do not print publicly available repositories at the end of the report', required: false , args: 0 )
27
+
cli.p(longOpt: 'printPublicRepos', 'Print publicly available repositories at the end of the report', required: false , args: 0 )
cli.c(longOpt: 'csv', 'CSV file with users in the format produced by stafftools/reports (show access for all contained users)', required: false, args: 1)
30
+
cli.e(longOpt: 'extendedpermissions', 'Print extended permissions (ALL, OWNER, PUBLIC, PRIVATE, MEMBER) why a repository can be accessed by that user, needs 4 times more API calls', required: false, args: 0)
28
31
29
32
OptionAccessor opt = cli.parse(args)
30
33
31
34
token = opt.t?opt.t:System.getenv("GITHUB_TOKEN")
32
35
url = opt.u?opt.u:System.getenv("GITHUB_URL")
33
-
listOnly = opt.l
34
36
35
37
// bail out if help parameter was supplied or not sufficient input to proceed
36
-
if (opt.h ||!token ||!url|| opt.arguments().size() ==0) {
cli =newCliBuilder(usage: 'groovy PrintRepoAccess.groovy [options] [repos]\nPrint out users that can access the repos specified, ALL if public repo')
34
34
cli.t(longOpt: 'token', 'personal access token of a GitHub Enterprise site admin with repo scope (or use GITHUB_TOKEN env variable)', required: false , args: 1 )
35
35
cli.u(longOpt: 'url', 'GitHub Enterprise URL (or use GITHUB_URL env variable), e.g. https://myghe.com', required: false , args: 1 )
36
36
cli.l(longOpt: 'localDirectory', 'Directory with org/repo directory structure (show access for all contained repos)', required: false, args: 1)
37
+
cli.c(longOpt: 'csv', 'CSV file with repositories in the format produced by stafftools/reports (show access for all contained repos)', required: false, args: 1)
0 commit comments