diff --git a/core/src/main/java/hudson/security/AuthorizationMatrixProperty.java b/core/src/main/java/hudson/security/AuthorizationMatrixProperty.java index d3a7b6ef1f..e6467932d3 100644 --- a/core/src/main/java/hudson/security/AuthorizationMatrixProperty.java +++ b/core/src/main/java/hudson/security/AuthorizationMatrixProperty.java @@ -1,5 +1,6 @@ package hudson.security; +import hudson.model.AbstractProject; import hudson.model.Item; import hudson.model.Job; import hudson.model.JobProperty; @@ -20,6 +21,7 @@ import net.sf.json.JSONObject; import org.acegisecurity.acls.sid.Sid; import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerResponse; import org.kohsuke.stapler.QueryParameter; import com.thoughtworks.xstream.converters.Converter; @@ -139,10 +141,10 @@ public class AuthorizationMatrixProperty extends JobProperty> { return p!=Item.CREATE; } - public void doCheckName(@QueryParameter String value) throws IOException, ServletException { - GlobalMatrixAuthorizationStrategy.DESCRIPTOR.doCheckName(value); + public void doCheckName(StaplerRequest req, StaplerResponse res, @QueryParameter String value) throws IOException, ServletException { + GlobalMatrixAuthorizationStrategy.DESCRIPTOR.doCheckName(value, req.findAncestorObject(AbstractProject.class), AbstractProject.CONFIGURE); } - } + } private final class AclImpl extends SidACL { protected Boolean hasPermission(Sid sid, Permission p) { diff --git a/core/src/main/java/hudson/security/GlobalMatrixAuthorizationStrategy.java b/core/src/main/java/hudson/security/GlobalMatrixAuthorizationStrategy.java index 3103335e95..b8d6f9c5c6 100644 --- a/core/src/main/java/hudson/security/GlobalMatrixAuthorizationStrategy.java +++ b/core/src/main/java/hudson/security/GlobalMatrixAuthorizationStrategy.java @@ -224,8 +224,12 @@ public class GlobalMatrixAuthorizationStrategy extends AuthorizationStrategy { } public void doCheckName(@QueryParameter String value ) throws IOException, ServletException { + doCheckName(value, Hudson.getInstance(), Hudson.ADMINISTER); + } + + void doCheckName(String value, AccessControlled subject, Permission permission) throws IOException, ServletException { final String v = value.substring(1,value.length()-1); - new FormFieldValidator(Hudson.ADMINISTER) { + new FormFieldValidator(subject, permission) { protected void check() throws IOException, ServletException { SecurityRealm sr = Hudson.getInstance().getSecurityRealm(); String ev = Functions.escape(v); diff --git a/core/src/main/resources/hudson/security/AuthorizationMatrixProperty/config.jelly b/core/src/main/resources/hudson/security/AuthorizationMatrixProperty/config.jelly index 94921fe385..be7c941ac6 100644 --- a/core/src/main/resources/hudson/security/AuthorizationMatrixProperty/config.jelly +++ b/core/src/main/resources/hudson/security/AuthorizationMatrixProperty/config.jelly @@ -1,5 +1,6 @@ + - \ No newline at end of file + diff --git a/core/src/main/resources/hudson/security/GlobalMatrixAuthorizationStrategy/config.jelly b/core/src/main/resources/hudson/security/GlobalMatrixAuthorizationStrategy/config.jelly index 4b8f917eac..b1624c592d 100644 --- a/core/src/main/resources/hudson/security/GlobalMatrixAuthorizationStrategy/config.jelly +++ b/core/src/main/resources/hudson/security/GlobalMatrixAuthorizationStrategy/config.jelly @@ -121,9 +121,12 @@ } e = null; }, + + + "#${strategyid} TR.permission-row" : function(e) { - FormChecker.delayedCheck("${rootURL}/descriptor/${descriptor.clazz.name}/checkName?value="+encode(e.getAttribute("name")),"GET",e.firstChild); + FormChecker.delayedCheck("${descriptorPath}/checkName?value="+encode(e.getAttribute("name")),"GET",e.firstChild); } });