diff --git a/core/src/main/java/hudson/maven/reporters/MavenAbstractArtifactRecord.java b/core/src/main/java/hudson/maven/reporters/MavenAbstractArtifactRecord.java index b03372863f..18a9b3d19d 100644 --- a/core/src/main/java/hudson/maven/reporters/MavenAbstractArtifactRecord.java +++ b/core/src/main/java/hudson/maven/reporters/MavenAbstractArtifactRecord.java @@ -13,6 +13,7 @@ import hudson.model.TaskThread; import hudson.model.BuildBadgeAction; import hudson.model.TaskThread.ListenerAndText; import hudson.security.Permission; +import hudson.security.ACL; import hudson.util.Iterators; import hudson.widgets.HistoryWidget; import hudson.widgets.HistoryWidget.Adapter; @@ -121,6 +122,10 @@ public abstract class MavenAbstractArtifactRecord> */ public abstract T getBuild(); + protected ACL getACL() { + return getBuild().getACL(); + } + public final String getIconFileName() { return "redo.gif"; } @@ -156,7 +161,7 @@ public abstract class MavenAbstractArtifactRecord> @QueryParameter("redeploy.id") final String id, @QueryParameter("redeploy.url") final String repositoryUrl, @QueryParameter("redeploy.uniqueVersion") final boolean uniqueVersion) throws ServletException, IOException { - getBuild().checkPermission(REDEPLOY); + getACL().checkPermission(REDEPLOY); File logFile = new File(getBuild().getRootDir(),"maven-deployment."+records.size()+".log"); final Record record = new Record(repositoryUrl, logFile.getName()); diff --git a/core/src/main/java/hudson/model/Run.java b/core/src/main/java/hudson/model/Run.java index 115729e25e..d45927c586 100644 --- a/core/src/main/java/hudson/model/Run.java +++ b/core/src/main/java/hudson/model/Run.java @@ -11,6 +11,7 @@ import static hudson.Util.combine; import hudson.XmlFile; import hudson.security.Permission; import hudson.security.PermissionGroup; +import hudson.security.ACL; import hudson.matrix.MatrixBuild; import hudson.matrix.MatrixRun; import hudson.model.listeners.RunListener; @@ -568,8 +569,12 @@ public abstract class Run ,RunT extends Run log; + /** + * Gets the permission object that represents the permission to perform this task. + */ protected abstract Permission getPermission(); - protected abstract AbstractBuild getBuild(); + /** + * Gets the {@link ACL} against which the permissions are checked. + */ + protected abstract ACL getACL(); public WeakReference getLog() { return log; @@ -68,7 +75,7 @@ public abstract class TaskAction extends AbstractModelObject implements Action { * Clears the error status. */ public synchronized void doClearError(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { - getBuild().checkPermission(getPermission()); + getACL().checkPermission(getPermission()); if(workerThread!=null && !workerThread.isAlive()) workerThread = null; diff --git a/core/src/main/java/hudson/scm/AbstractScmTagAction.java b/core/src/main/java/hudson/scm/AbstractScmTagAction.java index 8d39b9fa46..9c4fe37d13 100644 --- a/core/src/main/java/hudson/scm/AbstractScmTagAction.java +++ b/core/src/main/java/hudson/scm/AbstractScmTagAction.java @@ -3,6 +3,7 @@ package hudson.scm; import hudson.model.AbstractBuild; import hudson.model.TaskAction; import hudson.security.Permission; +import hudson.security.ACL; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; @@ -42,6 +43,10 @@ public abstract class AbstractScmTagAction extends TaskAction { return build; } + protected ACL getACL() { + return build.getACL(); + } + public void doIndex(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { req.getView(this,chooseAction()).forward(req,rsp); } diff --git a/core/src/main/java/hudson/scm/SubversionTagAction.java b/core/src/main/java/hudson/scm/SubversionTagAction.java index ce087cbaab..328941cf80 100644 --- a/core/src/main/java/hudson/scm/SubversionTagAction.java +++ b/core/src/main/java/hudson/scm/SubversionTagAction.java @@ -111,7 +111,7 @@ public class SubversionTagAction extends AbstractScmTagAction { * Invoked to actually tag the workspace. */ public synchronized void doSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { - getBuild().checkPermission(getPermission()); + getACL().checkPermission(getPermission()); Map newTags = new HashMap();