提交 fe500bf9 编写于 作者: K kohsuke

permission check not required for all checks

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@9795 71c3de6d-444a-0410-be80-ed276b4c234a
上级 7a9cc3ea
......@@ -36,6 +36,9 @@ public abstract class FormFieldValidator {
protected final StaplerRequest request;
protected final StaplerResponse response;
/**
* Permission to check, or null if this check doesn't require any permission.
*/
private final Permission permission;
......@@ -46,7 +49,7 @@ public abstract class FormFieldValidator {
* information or run a process that may have side-effect.
*/
protected FormFieldValidator(StaplerRequest request, StaplerResponse response, boolean adminOnly) {
this(request, response, CHECK);
this(request, response, adminOnly?CHECK:null);
}
protected FormFieldValidator(StaplerRequest request, StaplerResponse response, Permission permission) {
......@@ -59,7 +62,8 @@ public abstract class FormFieldValidator {
* Runs the validation code.
*/
public final void process() throws IOException, ServletException {
Hudson.getInstance().checkPermission(permission);
if(permission!=null)
Hudson.getInstance().checkPermission(permission);
check();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册