Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-37741] Testing /project path ont allowGitlabWebHookPermissio…
…n check
  • Loading branch information
Jairo Ricarte committed Sep 13, 2016
1 parent 4ec3989 commit 9e1768a
Showing 1 changed file with 10 additions and 3 deletions.
Expand Up @@ -134,7 +134,6 @@ public boolean hasPermission(Authentication a, Permission permission) {
}
}
}

// no match.
return false;
} else {
Expand All @@ -145,12 +144,10 @@ public boolean hasPermission(Authentication a, Permission permission) {
log.finest("Granting Full rights to SYSTEM user.");
return true;
}

if (authenticatedUserName.equals("anonymous")) {
if(checkJobStatusPermission(permission) && allowAnonymousJobStatusPermission) {
return true;
}

if (checkReadPermission(permission)) {
if (allowAnonymousReadPermission) {
return true;
Expand All @@ -168,6 +165,16 @@ public boolean hasPermission(Authentication a, Permission permission) {
}
log.finer("Denying anonymous READ permission to url: " + requestURI());
}

if (testBuildPermission(permission)) {
if (allowGitlabWebHookPermission &&
(currentUriPathStartsWith("/project/") ||
currentUriPathEquals("gitlab-webhook") ||
currentUriPathEquals("gitlab-webhook/"))) {
log.finest("Granting BUILD access for gitlab-webhook url: " + requestURI());
return true;
}
}
return false;
}

Expand Down

0 comments on commit 9e1768a

Please sign in to comment.