Skip to content

Commit

Permalink
[FIX JENKINS-22028] Allow MarkupFormatter without enabling security
Browse files Browse the repository at this point in the history
Given the current default of 'Escaped HTML', it makes no sense
to require users to 'Enable Security' to set up a less secure
alternative. So show it on the global security configuration page
on top level.
  • Loading branch information
daniel-beck committed May 11, 2014
1 parent 016f304 commit ac3a5cd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Expand Up @@ -99,15 +99,16 @@ public boolean configure(StaplerRequest req, JSONObject json) throws hudson.mode
} catch (IOException e) {
throw new hudson.model.Descriptor.FormException(e, "slaveAgentPortType");
}
if (security.has("markupFormatter")) {
j.setMarkupFormatter(req.bindJSON(MarkupFormatter.class, security.getJSONObject("markupFormatter")));
} else {
j.setMarkupFormatter(null);
}
} else {
j.disableSecurity();
}

if (json.has("markupFormatter")) {
j.setMarkupFormatter(req.bindJSON(MarkupFormatter.class, json.getJSONObject("markupFormatter")));
} else {
j.setMarkupFormatter(null);
}

// persist all the additional security configs
boolean result = true;
for(Descriptor<?> d : Functions.getSortedDescriptorsForGlobalConfig(FILTER)){
Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/jenkins/model/Jenkins.java
Expand Up @@ -2081,7 +2081,6 @@ public void disableSecurity() {
useSecurity = null;
setSecurityRealm(SecurityRealm.NO_AUTHENTICATION);
authorizationStrategy = AuthorizationStrategy.UNSECURED;
markupFormatter = null;
}

public void setProjectNamingStrategy(ProjectNamingStrategy ns) {
Expand Down
Expand Up @@ -33,8 +33,6 @@ l.layout(norefresh:true, permission:app.ADMINISTER, title:my.displayName) {
f.checkbox()
}

f.dropdownDescriptorSelector(title:_("Markup Formatter"),descriptors: MarkupFormatterDescriptor.all(), field: 'markupFormatter')

f.entry(title:_("Access Control")) {
table(style:"width:100%") {
f.descriptorRadioList(title:_("Security Realm"),varName:"realm", instance:app.securityRealm, descriptors:SecurityRealm.all())
Expand All @@ -43,6 +41,8 @@ l.layout(norefresh:true, permission:app.ADMINISTER, title:my.displayName) {
}
}

f.dropdownDescriptorSelector(title:_("Markup Formatter"),descriptors: MarkupFormatterDescriptor.all(), field: 'markupFormatter')

Functions.getSortedDescriptorsForGlobalConfig(my.FILTER).each { Descriptor descriptor ->
set("descriptor",descriptor)
set("instance",descriptor)
Expand Down

0 comments on commit ac3a5cd

Please sign in to comment.