use of password.pwm.config.PwmSettingTemplateSet in project pwm by pwm-project.
the class ConfigEditorServlet method generateSettingData.
public static Map<String, Object> generateSettingData(final PwmApplication pwmApplication, final StoredConfigurationImpl storedConfiguration, final SessionLabel sessionLabel, final Locale locale) throws PwmUnrecoverableException {
final LinkedHashMap<String, Object> returnMap = new LinkedHashMap<>();
final MacroMachine macroMachine = MacroMachine.forNonUserSpecific(pwmApplication, sessionLabel);
final PwmSettingTemplateSet template = storedConfiguration.getTemplateSet();
{
final LinkedHashMap<String, Object> settingMap = new LinkedHashMap<>();
for (final PwmSetting setting : PwmSetting.values()) {
settingMap.put(setting.getKey(), SettingInfo.forSetting(setting, template, macroMachine, locale));
}
returnMap.put("settings", settingMap);
}
{
final LinkedHashMap<String, Object> categoryMap = new LinkedHashMap<>();
for (final PwmSettingCategory category : PwmSettingCategory.values()) {
categoryMap.put(category.getKey(), CategoryInfo.forCategory(category, macroMachine, locale));
}
returnMap.put("categories", categoryMap);
}
{
final LinkedHashMap<String, Object> labelMap = new LinkedHashMap<>();
for (final PwmLocaleBundle localeBundle : PwmLocaleBundle.values()) {
final LocaleInfo localeInfo = new LocaleInfo();
localeInfo.description = localeBundle.getTheClass().getSimpleName();
localeInfo.key = localeBundle.toString();
localeInfo.adminOnly = localeBundle.isAdminOnly();
labelMap.put(localeBundle.getTheClass().getSimpleName(), localeInfo);
}
returnMap.put("locales", labelMap);
}
{
final LinkedHashMap<String, Object> varMap = new LinkedHashMap<>();
varMap.put("ldapProfileIds", storedConfiguration.readSetting(PwmSetting.LDAP_PROFILE_LIST).toNativeObject());
varMap.put("currentTemplate", storedConfiguration.getTemplateSet());
varMap.put("configurationNotes", storedConfiguration.readConfigProperty(ConfigurationProperty.NOTES));
returnMap.put("var", varMap);
}
return Collections.unmodifiableMap(returnMap);
}
use of password.pwm.config.PwmSettingTemplateSet in project pwm by pwm-project.
the class LDAPPermissionCalculator method figureStaticRecords.
private Collection<PermissionRecord> figureStaticRecords() {
final Set<PwmSettingTemplate> edirInterestedTemplates = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(PwmSettingTemplate.NOVL, PwmSettingTemplate.NOVL_IDM)));
final List<PermissionRecord> permissionRecords = new ArrayList<>();
final PwmSettingTemplateSet templateSet = storedConfiguration.getTemplateSet();
{
// edir specific attributes
if (!Collections.disjoint(templateSet.getTemplates(), edirInterestedTemplates)) {
final Map<String, LDAPPermissionInfo.Access> ldapAttributes = new LinkedHashMap<>();
ldapAttributes.put(ChaiConstant.ATTR_LDAP_LOCKED_BY_INTRUDER, LDAPPermissionInfo.Access.write);
ldapAttributes.put(ChaiConstant.ATTR_LDAP_LOGIN_INTRUDER_ATTEMPTS, LDAPPermissionInfo.Access.write);
ldapAttributes.put(ChaiConstant.ATTR_LDAP_LOGIN_INTRUDER_RESET_TIME, LDAPPermissionInfo.Access.write);
ldapAttributes.put(ChaiConstant.ATTR_LDAP_LOGIN_GRACE_LIMIT, LDAPPermissionInfo.Access.write);
ldapAttributes.put(ChaiConstant.ATTR_LDAP_LOGIN_GRACE_REMAINING, LDAPPermissionInfo.Access.write);
ldapAttributes.put(ChaiConstant.ATTR_LDAP_PASSWORD_EXPIRE_TIME, LDAPPermissionInfo.Access.read);
for (final Map.Entry<String, LDAPPermissionInfo.Access> entry : ldapAttributes.entrySet()) {
final String ldapAttribute = entry.getKey();
permissionRecords.add(new PermissionRecord(ldapAttribute, null, null, entry.getValue(), LDAPPermissionInfo.Actor.proxy));
}
}
}
if (configuration.getLdapProfiles() != null && !configuration.getLdapProfiles().isEmpty()) {
for (final LdapProfile ldapProfile : configuration.getLdapProfiles().values()) {
final List<String> autoAddObjectClasses = ldapProfile.readSettingAsStringArray(PwmSetting.AUTO_ADD_OBJECT_CLASSES);
if (autoAddObjectClasses != null && !autoAddObjectClasses.isEmpty()) {
permissionRecords.add(new PermissionRecord(ChaiConstant.ATTR_LDAP_OBJECTCLASS, PwmSetting.AUTO_ADD_OBJECT_CLASSES, ldapProfile.getIdentifier(), LDAPPermissionInfo.Access.write, LDAPPermissionInfo.Actor.proxy));
}
}
}
return permissionRecords;
}
Aggregations