Skip to content

Commit

Permalink
Temporary fix for JENKINS-16980, prevent users without RUN_SCRIPTS pe…
Browse files Browse the repository at this point in the history
…rmission from editing Groovy DSL
  • Loading branch information
daniel-beck committed Jul 14, 2013
1 parent 425780a commit 12ef23e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/main/java/com/cloudbees/plugins/flow/BuildFlow.java
Expand Up @@ -29,6 +29,8 @@
import hudson.util.AlternativeUiTextProvider;
import hudson.util.DescribableList;

import jenkins.model.Jenkins;

import java.io.IOException;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -68,7 +70,9 @@ public void setDsl(String dsl) {
protected void submit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException {
super.submit(req, rsp);
JSONObject json = req.getSubmittedForm();
this.dsl = json.getString("dsl");
if (Jenkins.getInstance().hasPermission(Jenkins.RUN_SCRIPTS)) {
this.dsl = json.getString("dsl");
}
}

@Extension
Expand Down
Expand Up @@ -23,7 +23,8 @@
</p:config-trigger>

<f:entry field="dsl" title="${%Define build flow using flow DSL}">
<f:textarea/>
<j:getStatic var="permission" className="hudson.model.Hudson" field="RUN_SCRIPTS"/>
<f:textarea readonly="${h.hasPermission(it,permission) ? null : 'readonly'}" />
</f:entry>

<p:config-publishers2 />
Expand Down

0 comments on commit 12ef23e

Please sign in to comment.