use of org.apache.archiva.configuration.model.LdapGroupMapping in project archiva by apache.
the class ConfigurationRegistryReader method readLdapGroupMapping.
private LdapGroupMapping readLdapGroupMapping(String prefix, Registry registry) {
LdapGroupMapping value = new LdapGroupMapping();
// String group = registry.getString( prefix + "group", value.getGroup() );
List<String> groupList = registry.getList(prefix + "group");
String group = value.getGroup();
if (groupList != null && !groupList.isEmpty()) {
StringBuilder sb = new StringBuilder();
for (int i = 0, size = groupList.size(); i < size; i++) {
sb.append(groupList.get(i));
if (i < size - 1) {
sb.append(',');
}
}
group = sb.toString();
}
value.setGroup(group);
java.util.List roleNames = new java.util.ArrayList();
roleNames.addAll(registry.getList(prefix + "roleNames.roleName"));
value.setRoleNames(roleNames);
return value;
}
use of org.apache.archiva.configuration.model.LdapGroupMapping in project archiva by apache.
the class ConfigurationRegistryWriter method writeRedbackRuntimeConfiguration.
private void writeRedbackRuntimeConfiguration(String prefix, RedbackRuntimeConfiguration value, Registry registry) {
if (value != null) {
String migratedFromRedbackConfiguration = "migratedFromRedbackConfiguration";
registry.setBoolean(prefix + migratedFromRedbackConfiguration, value.isMigratedFromRedbackConfiguration());
if (value.getUserManagerImpls() != null && value.getUserManagerImpls().size() > 0) {
registry.removeSubset(prefix + "userManagerImpls");
int count = 0;
for (Iterator iter = value.getUserManagerImpls().iterator(); iter.hasNext(); count++) {
String name = "userManagerImpls.userManagerImpl(" + count + ")";
String userManagerImpl = (String) iter.next();
registry.setString(prefix + name, userManagerImpl);
}
}
if (value.getRbacManagerImpls() != null && value.getRbacManagerImpls().size() > 0) {
registry.removeSubset(prefix + "rbacManagerImpls");
int count = 0;
for (Iterator iter = value.getRbacManagerImpls().iterator(); iter.hasNext(); count++) {
String name = "rbacManagerImpls.rbacManagerImpl(" + count + ")";
String rbacManagerImpl = (String) iter.next();
registry.setString(prefix + name, rbacManagerImpl);
}
}
if (value.getLdapConfiguration() != null) {
writeLdapConfiguration(prefix + "ldapConfiguration.", value.getLdapConfiguration(), registry);
}
if (value.getLdapGroupMappings() != null && value.getLdapGroupMappings().size() > 0) {
registry.removeSubset(prefix + "ldapGroupMappings");
int count = 0;
for (Iterator iter = value.getLdapGroupMappings().iterator(); iter.hasNext(); count++) {
String name = "ldapGroupMappings.ldapGroupMapping(" + count + ")";
LdapGroupMapping o = (LdapGroupMapping) iter.next();
writeLdapGroupMapping(prefix + name + ".", o, registry);
}
}
if (value.getConfigurationProperties() != null && value.getConfigurationProperties().size() > 0) {
registry.removeSubset(prefix + "configurationProperties");
for (Iterator iter = value.getConfigurationProperties().keySet().iterator(); iter.hasNext(); ) {
String key = (String) iter.next();
String v = (String) value.getConfigurationProperties().get(key);
registry.setString(prefix + "configurationProperties." + key, v);
}
}
String useUsersCache = "useUsersCache";
registry.setBoolean(prefix + useUsersCache, value.isUseUsersCache());
if (value.getUsersCacheConfiguration() != null) {
writeCacheConfiguration(prefix + "usersCacheConfiguration.", value.getUsersCacheConfiguration(), registry);
}
}
}
use of org.apache.archiva.configuration.model.LdapGroupMapping in project archiva by apache.
the class ConfigurationRegistryReader method readRedbackRuntimeConfiguration.
private RedbackRuntimeConfiguration readRedbackRuntimeConfiguration(String prefix, Registry registry) {
RedbackRuntimeConfiguration value = new RedbackRuntimeConfiguration();
boolean migratedFromRedbackConfiguration = registry.getBoolean(prefix + "migratedFromRedbackConfiguration", value.isMigratedFromRedbackConfiguration());
value.setMigratedFromRedbackConfiguration(migratedFromRedbackConfiguration);
java.util.List userManagerImpls = new java.util.ArrayList();
userManagerImpls.addAll(registry.getList(prefix + "userManagerImpls.userManagerImpl"));
value.setUserManagerImpls(userManagerImpls);
java.util.List rbacManagerImpls = new java.util.ArrayList();
rbacManagerImpls.addAll(registry.getList(prefix + "rbacManagerImpls.rbacManagerImpl"));
value.setRbacManagerImpls(rbacManagerImpls);
LdapConfiguration ldapConfiguration = readLdapConfiguration(prefix + "ldapConfiguration.", registry);
value.setLdapConfiguration(ldapConfiguration);
java.util.List ldapGroupMappings = new java.util.ArrayList();
List ldapGroupMappingsSubsets = registry.getSubsetList(prefix + "ldapGroupMappings.ldapGroupMapping");
for (Iterator i = ldapGroupMappingsSubsets.iterator(); i.hasNext(); ) {
LdapGroupMapping v = readLdapGroupMapping("", (Registry) i.next());
ldapGroupMappings.add(v);
}
value.setLdapGroupMappings(ldapGroupMappings);
java.util.Map configurationProperties = registry.getProperties(prefix + "configurationProperties");
value.setConfigurationProperties(configurationProperties);
boolean useUsersCache = registry.getBoolean(prefix + "useUsersCache", value.isUseUsersCache());
value.setUseUsersCache(useUsersCache);
CacheConfiguration usersCacheConfiguration = readCacheConfiguration(prefix + "usersCacheConfiguration.", registry);
value.setUsersCacheConfiguration(usersCacheConfiguration);
return value;
}
Aggregations