mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-10-30 13:05:19 +00:00
adding more convenience methods.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@6467 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
5a83f88fe9
commit
7155fb5bda
1 file changed
+12
-1
@@ -414,6 +414,17 @@ public class Functions {
|
||||
return Util.xmlEscape(s);
|
||||
}
|
||||
|
||||
public static void checkPermission(Permission permission) throws IOException, ServletException {
|
||||
Hudson.getInstance().getACL().checkPermission(permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the current user has the given permission.
|
||||
*/
|
||||
public static boolean hasPermission(Permission permission) throws IOException, ServletException {
|
||||
return Hudson.getInstance().getACL().hasPermission(permission);
|
||||
}
|
||||
|
||||
public static void adminCheck(StaplerRequest req, StaplerResponse rsp, Object required, Permission permission) throws IOException, ServletException {
|
||||
// this is legacy --- all views should be eventually converted to
|
||||
// the permission based model.
|
||||
@@ -426,7 +437,7 @@ public class Functions {
|
||||
|
||||
// make sure the user owns the necessary permission to access this page.
|
||||
if(permission!=null)
|
||||
Hudson.getInstance().getACL().checkPermission(permission);
|
||||
checkPermission(permission);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user