From 983f99e20dc3aa4cfb30236b1d68b0c20860e2a0 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Fri, 4 Jan 2008 01:58:09 +0000 Subject: [PATCH] This defaulting is convenient in making the use of this method terse. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@6471 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/Functions.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/Functions.java b/core/src/main/java/hudson/Functions.java index 2fe578d54d..acb29d88cc 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 {