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
This commit is contained in:
kohsuke committed 2008-01-04 01:58:09 +00:00
1 parent 445d05ea4c
commit 983f99e20d
1 file changed
+4 -1
+4 -1
View File
@@ -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 {