Skip to content

Commit

Permalink
[SECURITY-2794]
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-beck committed Jun 21, 2022
1 parent 63f82f2 commit 4021487
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,11 @@ public String doText(StaplerRequest req, StaplerResponse rsp, @QueryParameter St
}

// check if user has permission to view the status
if(throwErrorWhenNotFound && (p == null || !p.hasPermission(VIEW_STATUS))){
throw HttpResponses.notFound();
if (p == null || !p.hasPermission(VIEW_STATUS)) {
if (throwErrorWhenNotFound) {
throw HttpResponses.notFound();
}
return null;
}

return p;
Expand Down Expand Up @@ -180,8 +183,11 @@ public String doText(StaplerRequest req, StaplerResponse rsp, @QueryParameter St
}
}
// check if user has permission to view the status
if(throwErrorWhenNotFound && (run == null || !run.hasPermission(VIEW_STATUS))){
throw HttpResponses.notFound();
if (run == null || !run.hasPermission(VIEW_STATUS)) {
if (throwErrorWhenNotFound) {
throw HttpResponses.notFound();
}
return null;
}

return run;
Expand Down

0 comments on commit 4021487

Please sign in to comment.