Skip to content

Commit

Permalink
Fix JENKINS-15171
Browse files Browse the repository at this point in the history
  • Loading branch information
gboissinot committed Sep 16, 2012
1 parent c1f712c commit 90e72c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Expand Up @@ -2,6 +2,8 @@


import hudson.model.AbstractProject; import hudson.model.AbstractProject;
import hudson.model.Action; import hudson.model.Action;
import hudson.model.Item;
import org.acegisecurity.AccessDeniedException;
import org.kohsuke.stapler.StaplerProxy; import org.kohsuke.stapler.StaplerProxy;


/** /**
Expand All @@ -24,7 +26,12 @@ public String getDisplayName() {
} }


public String getUrlName() { public String getUrlName() {
return "dryRun"; try {
target.checkPermission(Item.BUILD);
return "dryRun";
} catch (AccessDeniedException ae) {
return null;
}
} }


public Object getTarget() { public Object getTarget() {
Expand Down
@@ -1,6 +1,7 @@
package org.jenkinsci.plugins.dryrun; package org.jenkinsci.plugins.dryrun;


import hudson.model.AbstractProject; import hudson.model.AbstractProject;
import hudson.model.Item;
import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse; import org.kohsuke.stapler.StaplerResponse;


Expand All @@ -21,6 +22,7 @@ public DryRunUserAction(AbstractProject project) {


@SuppressWarnings("unused") @SuppressWarnings("unused")
public void doDynamic(String token, StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { public void doDynamic(String token, StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
project.checkPermission(Item.BUILD);
project.scheduleBuild(0, new DryRunCause(), new DryRunActivateListenerAction(), new DryRunBuildBadgeAction()); project.scheduleBuild(0, new DryRunCause(), new DryRunActivateListenerAction(), new DryRunBuildBadgeAction());
rsp.forwardToPreviousPage(req); rsp.forwardToPreviousPage(req);
} }
Expand Down

0 comments on commit 90e72c3

Please sign in to comment.