提交 aeefa6eb 编写于 作者: J Jesse Glick

More informative error when refusing to copy.

上级 3d655938
......@@ -27,7 +27,6 @@ import hudson.Util;
import hudson.XmlFile;
import hudson.model.listeners.ItemListener;
import hudson.security.AccessControlled;
import hudson.security.AccessDeniedException2;
import hudson.util.CopyOnWriteMap;
import hudson.util.Function1;
import hudson.util.Secret;
......@@ -51,6 +50,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import jenkins.security.NotReallyRoleSensitiveCallable;
import org.acegisecurity.AccessDeniedException;
import org.xml.sax.SAXException;
/**
......@@ -229,7 +229,8 @@ public abstract class ItemGroupMixIn {
Matcher matcher = AbstractItem.SECRET_PATTERN.matcher(srcConfigFile.asString());
while (matcher.find()) {
if (Secret.decrypt(matcher.group(1)) != null) {
throw new AccessDeniedException2(Jenkins.getAuthentication(), Item.CONFIGURE);
// AccessDeniedException2 does not permit a custom message, and anyway redirecting the user to the login screen is obviously pointless.
throw new AccessDeniedException(Messages.ItemGroupMixIn_may_not_copy_as_it_contains_secrets_and_(src.getFullName(), Jenkins.getAuthentication().getName(), Item.PERMISSIONS.title, Item.EXTENDED_READ.name, Item.CONFIGURE.name));
}
}
}
......
......@@ -175,7 +175,7 @@ Item.CREATE.description=Create a new job.
Item.DELETE.description=Delete a job.
Item.CONFIGURE.description=Change the configuration of a job.
Item.READ.description=See a job. (You may deny this permission but allow Discover to force an anonymous user to log in to see the job.)
ItemGroupMixIn.may_not_copy_as_it_contains_secrets_and_=May not copy {0} as it contains secrets and {1} has {2}/{3} but not /{4}
Job.AllRecentBuildFailed=All recent builds failed.
Job.BuildStability=Build stability: {0}
Job.NOfMFailed={0} out of the last {1} builds failed.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册