Skip to content
Permalink
Browse files

[FIXED JENKINS-19988] Changes to script parameters in Run Script wind…

…ow affect permanent definitions
  • Loading branch information
imod committed Feb 22, 2014
1 parent 739e386 commit 5c1d2f0af8cc88773507e6755215e75c9d9a4bdc
@@ -456,13 +456,13 @@ public void doTriggerScript(StaplerRequest req, StaplerResponse rsp, @QueryParam
final boolean isChangeScriptAllowed = isAdmin || allowRunScriptEdit();

if (!isChangeScriptAllowed) {
tempScript = ScriptHelper.getScript(id, true);
tempScript = ScriptHelper.getScriptCopy(id, true);
// use original script, user has no permission to change it!s
scriptSrc = tempScript.script;
} else {
// set the script info back to the request, to display it together with
// the output.
tempScript = ScriptHelper.getScript(id, false);
tempScript = ScriptHelper.getScriptCopy(id, false);
tempScript.setScript(scriptSrc);
}

@@ -93,6 +93,10 @@ public Script(String id, String name, String comment, String originCatalog, Stri
this.onlyMaster = onlyMaster;
}

public Script copy() {
return new Script(id, name, comment, originCatalog, originScript, originDate, nonAdministerUsing, parameters, onlyMaster);
}

/*
* (non-Javadoc)
*
@@ -48,6 +48,11 @@
JSON_CLASS_MAPPING.put("parameters", Parameter.class);
}

public static Script getScriptCopy(String id, boolean withSrc) {
final Script orig = getScript(id, withSrc);
return orig.copy();
}

/**
* Loads the script information.
*

0 comments on commit 5c1d2f0

Please sign in to comment.
You can’t perform that action at this time.