use of org.acegisecurity.AccessDeniedException in project workflow-cps-plugin by jenkinsci.
the class ReplayAction method doRun.
@Restricted(DoNotUse.class)
@RequirePOST
public void doRun(StaplerRequest req, StaplerResponse rsp) throws ServletException, IOException {
if (!isEnabled() || !(isReplayableSandboxTest())) {
// AccessDeniedException2 requires us to look up the specific Permission
throw new AccessDeniedException("not allowed to replay");
}
JSONObject form = req.getSubmittedForm();
// Copy originalLoadedScripts, replacing values with those from the form wherever defined.
Map<String, String> replacementLoadedScripts = new HashMap<>();
for (Map.Entry<String, String> entry : getOriginalLoadedScripts().entrySet()) {
// optString since you might be replaying a running build, which might have loaded a script after the page load but before submission.
replacementLoadedScripts.put(entry.getKey(), form.optString(entry.getKey().replace('.', '_'), entry.getValue()));
}
if (run(form.getString("mainScript"), replacementLoadedScripts) == null) {
throw HttpResponses.error(SC_CONFLICT, new IOException(run.getParent().getFullName() + " is not buildable"));
}
// back to WorkflowJob; new build might not start instantly so cannot redirect to it
rsp.sendRedirect("../..");
}
Aggregations