Skip to content
Permalink
Browse files
[JENKINS-28298] Saves enabled / disabled configuration to the disk.
  • Loading branch information
ikedam committed Jul 1, 2015
1 parent 4bc59e0 commit 369cb1011903edc7c67f78afaf30204b1520ea61
Showing 1 changed file with 15 additions and 6 deletions.
@@ -25,6 +25,7 @@
package org.jenkinsci.plugins.authorizeproject;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@@ -61,8 +62,8 @@ public ProjectQueueItemAuthenticator() {
this(Collections.<String, Boolean>emptyMap());
}

public ProjectQueueItemAuthenticator(Map<String,Boolean> strategyEnableMap) {
this.strategyEnabledMap = strategyEnableMap;
public ProjectQueueItemAuthenticator(Map<String,Boolean> strategyEnabledMap) {
this.strategyEnabledMap = strategyEnabledMap;
}

public Object readResolve() {
@@ -146,16 +147,24 @@ public List<Descriptor<AuthorizeProjectStrategy>> getAvailableDescriptorList() {
public ProjectQueueItemAuthenticator newInstance(StaplerRequest req, JSONObject formData)
throws FormException
{
ProjectQueueItemAuthenticator r = (ProjectQueueItemAuthenticator)super.newInstance(req, formData);
Map<String,Boolean> strategyEnabledMap = new HashMap<String, Boolean>();

for (AuthorizeProjectStrategyDescriptor d : getDescriptorsForGlobalSecurityConfigPage()) {
for (Descriptor<AuthorizeProjectStrategy> d : getAvailableDescriptorList()) {
String name = d.getJsonSafeClassName();
if (formData.has(name)) {
d.configureFromGlobalSecurity(req, formData.getJSONObject(name));
strategyEnabledMap.put(d.getId(), true);
if (
d instanceof AuthorizeProjectStrategyDescriptor
&& ((AuthorizeProjectStrategyDescriptor)d).getGlobalSecurityConfigPage() != null
) {
((AuthorizeProjectStrategyDescriptor)d).configureFromGlobalSecurity(req, formData.getJSONObject(name));
}
} else {
strategyEnabledMap.put(d.getId(), false);
}
}

return r;
return new ProjectQueueItemAuthenticator(strategyEnabledMap);
}
}

0 comments on commit 369cb10

Please sign in to comment.