Skip to content

Commit

Permalink
If no project is given, fall back to global permission.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Feb 15, 2021
1 parent 7daad72 commit 2f7d57d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/io/jenkins/plugins/util/JenkinsFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import org.apache.commons.lang3.StringUtils;

import edu.umd.cs.findbugs.annotations.CheckForNull;

import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.StaplerRequest;
import hudson.DescriptorExtensionList;
Expand Down Expand Up @@ -86,7 +88,10 @@ public boolean hasPermission(final Permission permission) {
*
* @return {@code false} if the user doesn't have the permission
*/
public boolean hasPermission(final Permission permission, final Job<?, ?> project) {
public boolean hasPermission(final Permission permission, @CheckForNull final Job<?, ?> project) {
if (project == null) {
return hasPermission(permission);
}
return getJenkins().getAuthorizationStrategy().getACL(project).hasPermission(permission);
}

Expand Down

0 comments on commit 2f7d57d

Please sign in to comment.