diff --git a/core/src/main/java/hudson/Functions.java b/core/src/main/java/hudson/Functions.java index 2fe578d54d749720495093490fa01ecfee50a48f..acb29d88cc7cbe128ca8e5759792e6ec805b5d60 100644 --- a/core/src/main/java/hudson/Functions.java +++ b/core/src/main/java/hudson/Functions.java @@ -420,9 +420,12 @@ public class Functions { /** * Returns true if the current user has the given permission. + * + * @param permission + * If null, returns true. This defaulting is convenient in making the use of this method terse. */ public static boolean hasPermission(Permission permission) throws IOException, ServletException { - return Hudson.getInstance().getACL().hasPermission(permission); + return permission==null || Hudson.getInstance().getACL().hasPermission(permission); } public static void adminCheck(StaplerRequest req, StaplerResponse rsp, Object required, Permission permission) throws IOException, ServletException {