calls PermissionService.hasAnyUserPermission with SYSADMIN and ADMIN. The contract on hasAnyUserPermission only allows resource permissions to be queried (PROJECT* or REPO*). If you provide a global permission, an IllegalArgumentException is thrown.
The whole check can be collapsed into a single call permissions.hasRepositoryPermission(currentUser, repo, Permission.REPO_ADMIN) because PROJECT_ADMIN, ADMIN and SYSADMIN all imply REPO_ADMIN
https://github.com/ngsru/atlassian-external-hooks/blob/master/src/main/java/com/ngs/stash/externalhooks/hook/ExternalPreReceiveHook.java#L52
calls PermissionService.hasAnyUserPermission with SYSADMIN and ADMIN. The contract on hasAnyUserPermission only allows resource permissions to be queried (PROJECT* or REPO*). If you provide a global permission, an IllegalArgumentException is thrown.
The whole check can be collapsed into a single call permissions.hasRepositoryPermission(currentUser, repo, Permission.REPO_ADMIN) because PROJECT_ADMIN, ADMIN and SYSADMIN all imply REPO_ADMIN