Skip to content

Commit

Permalink
[JENKINS-32770] Address issues identified by jglick
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenc committed Feb 5, 2016
1 parent 77cd5e8 commit cca87b5
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -98,7 +98,7 @@ protected static SystemAuthorizationStrategy getCurrentStrategy(Job<?, ?> job) {
*/
private Object readResolve() throws IOException {
Jenkins instance = Jenkins.getInstance();
if (instance == null || !instance.hasPermission(Jenkins.ADMINISTER)) {
if (instance == null || !instance.hasPermission(Jenkins.RUN_SCRIPTS)) {
// This is called via REST/CLI.
// As REST/CLI interface saves configuration after successfully load object from the XML,
// this prevents the new configuration saved.
Expand Down Expand Up @@ -206,10 +206,10 @@ public SystemAuthorizationStrategy newInstance(StaplerRequest req, JSONObject fo
throws FormException {
SystemAuthorizationStrategy result = (SystemAuthorizationStrategy) super.newInstance(req, formData);
Jenkins instance = Jenkins.getInstance();
if (instance == null || !instance.hasPermission(Jenkins.ADMINISTER)) {
if (instance == null || !instance.hasPermission(Jenkins.RUN_SCRIPTS)) {
Job job = req.findAncestorObject(Job.class);
if (job != null) {
if (!(permitReconfiguration && result.equals(getCurrentStrategy(job)))) {
if (!(permitReconfiguration && getCurrentStrategy(job) != null)) {
throw new FormException(Messages.SystemAuthorizationStrategy_administersOnly(), "strategy");
}
}
Expand Down

0 comments on commit cca87b5

Please sign in to comment.