Permalink
Browse files

[JENKINS-34281] More general fix of CpsFlowExecution.suspendAll ACL b…

…ug which could help with InputAction.loadExecutions as well.
  • Loading branch information...
jglick committed Aug 3, 2016
1 parent e6d3a2e commit 5c8499e19aae9a47207cde1072b1775230edf15b
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
@@ -52,6 +52,7 @@
import hudson.scm.ChangeLogSet;
import hudson.scm.SCM;
import hudson.scm.SCMRevisionState;
import hudson.security.ACL;
import hudson.util.Iterators;
import hudson.util.NullStream;
import hudson.util.PersistedList;
@@ -82,6 +83,7 @@
import jenkins.model.lazy.BuildReference;
import jenkins.model.lazy.LazyBuildMixIn;
import jenkins.model.queue.AsynchronousExecution;
import jenkins.security.NotReallyRoleSensitiveCallable;
import jenkins.util.Timer;
import org.jenkinsci.plugins.workflow.actions.LogAction;
import org.jenkinsci.plugins.workflow.actions.ThreadNameAction;
@@ -705,11 +707,15 @@ private String key() {
if (candidate != null && candidate.getParent().getFullName().equals(job) && candidate.getId().equals(id)) {
run = candidate;
} else {
Jenkins jenkins = Jenkins.getInstance();
final Jenkins jenkins = Jenkins.getInstance();
if (jenkins == null) {
throw new IOException("Jenkins is not running"); // do not use Jenkins.getActiveInstance() as that is an ISE
}
WorkflowJob j = jenkins.getItemByFullName(job, WorkflowJob.class);
WorkflowJob j = ACL.impersonate(ACL.SYSTEM, new NotReallyRoleSensitiveCallable<WorkflowJob,IOException>() {
@Override public WorkflowJob call() throws IOException {
return jenkins.getItemByFullName(job, WorkflowJob.class);
}
});
if (j == null) {
throw new IOException("no such WorkflowJob " + job);
}

0 comments on commit 5c8499e

Please sign in to comment.