Преглед на файлове

add PwmSettingPropertyTest and fix issues discovered by test.

Jason Rivard преди 7 години
родител
ревизия
5daf8f5314

+ 2 - 2
server/src/main/java/password/pwm/config/PwmSetting.java

@@ -1361,12 +1361,12 @@ public enum PwmSetting {
     }
     }
 
 
     public String getLabel(final Locale locale) {
     public String getLabel(final Locale locale) {
-        final String propertyKey = "Setting_Label_" + this.getKey();
+        final String propertyKey = password.pwm.i18n.PwmSetting.SETTING_LABEL_PREFIX + this.getKey();
         return LocaleHelper.getLocalizedMessage(locale, propertyKey, null, password.pwm.i18n.PwmSetting.class);
         return LocaleHelper.getLocalizedMessage(locale, propertyKey, null, password.pwm.i18n.PwmSetting.class);
     }
     }
 
 
     public String getDescription(final Locale locale) {
     public String getDescription(final Locale locale) {
-        final String propertyKey = "Setting_Description_" + this.getKey();
+        final String propertyKey = password.pwm.i18n.PwmSetting.SETTING_DESCRIPTION_PREFIX + this.getKey();
         final String storedText = LocaleHelper.getLocalizedMessage(locale, propertyKey, null, password.pwm.i18n.PwmSetting.class);
         final String storedText = LocaleHelper.getLocalizedMessage(locale, propertyKey, null, password.pwm.i18n.PwmSetting.class);
         final MacroMachine macroMachine = MacroMachine.forStatic();
         final MacroMachine macroMachine = MacroMachine.forStatic();
         return macroMachine.expandMacros(storedText);
         return macroMachine.expandMacros(storedText);

+ 2 - 2
server/src/main/java/password/pwm/config/PwmSettingCategory.java

@@ -212,12 +212,12 @@ public enum PwmSettingCategory {
     }
     }
 
 
     public String getLabel(final Locale locale) {
     public String getLabel(final Locale locale) {
-        final String key = "Category_Label_" + this.getKey();
+        final String key = PwmSetting.CATEGORY_LABEL_PREFIX + this.getKey();
         return LocaleHelper.getLocalizedMessage(locale, key, null, PwmSetting.class);
         return LocaleHelper.getLocalizedMessage(locale, key, null, PwmSetting.class);
     }
     }
 
 
     public String getDescription(final Locale locale) {
     public String getDescription(final Locale locale) {
-        final String key = "Category_Description_" + this.getKey();
+        final String key = PwmSetting.CATEGORY_DESCRIPTION_PREFIX + this.getKey();
         return LocaleHelper.getLocalizedMessage(locale, key, null, PwmSetting.class);
         return LocaleHelper.getLocalizedMessage(locale, key, null, PwmSetting.class);
     }
     }
 
 

+ 6 - 1
server/src/main/java/password/pwm/i18n/PwmSetting.java

@@ -24,9 +24,14 @@ package password.pwm.i18n;
 
 
 public enum PwmSetting implements PwmDisplayBundle {
 public enum PwmSetting implements PwmDisplayBundle {
 
 
-
     ;
     ;
 
 
+    public static final String SETTING_LABEL_PREFIX = "Setting_Label_";
+    public static final String SETTING_DESCRIPTION_PREFIX = "Setting_Description_";
+
+    public static final String CATEGORY_LABEL_PREFIX = "Category_Label_";
+    public static final String CATEGORY_DESCRIPTION_PREFIX = "Category_Description_";
+
     @Override
     @Override
     public String getKey() {
     public String getKey() {
         return this.toString();
         return this.toString();

+ 3 - 10
server/src/main/resources/password/pwm/i18n/PwmSetting.properties

@@ -191,7 +191,6 @@ Category_Label_REST_SERVER=REST Services
 Category_Label_SECURITY=Security
 Category_Label_SECURITY=Security
 Category_Label_SETTINGS=Settings
 Category_Label_SETTINGS=Settings
 Category_Label_SHORTCUT=Shortcut Menu
 Category_Label_SHORTCUT=Shortcut Menu
-Category_Label_PROFILE=Link Menu
 Category_Label_SMS_GATEWAY=SMS Gateway
 Category_Label_SMS_GATEWAY=SMS Gateway
 Category_Label_SMS_MESSAGES=SMS Messages
 Category_Label_SMS_MESSAGES=SMS Messages
 Category_Label_SMS=SMS
 Category_Label_SMS=SMS
@@ -412,8 +411,7 @@ Setting_Description_intruder.enable=Enable this option to enable the @PwmAppName
 Setting_Description_intruder.session.maxAttempts=Specify the maximum amount of intruder attempts per session.  When the user exceeds this limit, @PwmAppName@ "locks" the session, and no other requests using that session succeed.  A value of zero disables the session lockout functionality.
 Setting_Description_intruder.session.maxAttempts=Specify the maximum amount of intruder attempts per session.  When the user exceeds this limit, @PwmAppName@ "locks" the session, and no other requests using that session succeed.  A value of zero disables the session lockout functionality.
 Setting_Description_intruder.storageMethod=Select the data store used for Intruder Records.  If you use <b>Database</b>, all application instances share a common view of intruder status.  If you use <b>LocalDB</b>, each instance has its own intruder state.  LocalDB is likely to have less performance overhead and having a consistent intruder state across all application instances might not be important.  The Configure Guide uses a database if configured, if not it uses the LocalDB.
 Setting_Description_intruder.storageMethod=Select the data store used for Intruder Records.  If you use <b>Database</b>, all application instances share a common view of intruder status.  If you use <b>LocalDB</b>, each instance has its own intruder state.  LocalDB is likely to have less performance overhead and having a consistent intruder state across all application instances might not be important.  The Configure Guide uses a database if configured, if not it uses the LocalDB.
 Setting_Description_intruder.tokenDest.checkTime=Specify the maximum time period between each intruder attempt.  When the user exceeds this time period, @PwmAppName@ resets the intruder attempt count to zero.
 Setting_Description_intruder.tokenDest.checkTime=Specify the maximum time period between each intruder attempt.  When the user exceeds this time period, @PwmAppName@ resets the intruder attempt count to zero.
-Setting_Description_intruder.tokenDest.maxAttempts=Specify the maximum number of attempts a user might make before a lockout occurs.  
-After the user exceeds this value, the user cannot perform any activities until the reset time interval has passed.   A value of zero disables the user lockout functionality.
+Setting_Description_intruder.tokenDest.maxAttempts=Specify the maximum number of attempts a token destination can be used before a lockout occurs and the token destination can no longer be sent tokens.  After the user exceeds this value, the user cannot perform any activities until the reset time interval has passed.   A value of zero disables the token lockout functionality.
 Setting_Description_intruder.tokenDest.resetTime=Specify the time period after which @PwmAppName@ clears a bad attempt from the lockout table.  @PwmAppName@ marks the attribute lockout table for a user anytime it sends a token, and it clears the lockout when the user consumes a token.  <br/><br/>Value is in number of seconds.  A value of zero disables the attribute lockout functionality.
 Setting_Description_intruder.tokenDest.resetTime=Specify the time period after which @PwmAppName@ clears a bad attempt from the lockout table.  @PwmAppName@ marks the attribute lockout table for a user anytime it sends a token, and it clears the lockout when the user consumes a token.  <br/><br/>Value is in number of seconds.  A value of zero disables the attribute lockout functionality.
 Setting_Description_intruder.user.checkTime=Specify the maximum time period between each intruder attempt.  When the user exceeds this time period, @PwmAppName@ resets the intruder attempt count to zero.
 Setting_Description_intruder.user.checkTime=Specify the maximum time period between each intruder attempt.  When the user exceeds this time period, @PwmAppName@ resets the intruder attempt count to zero.
 Setting_Description_intruder.user.maxAttempts=Specify the maximum number of attempts a user might make before a lockout occurs.  After the user exceeds this value, the user cannot perform any activities until the reset time interval has passed.   A value of zero disables the user lockout functionality.
 Setting_Description_intruder.user.maxAttempts=Specify the maximum number of attempts a user might make before a lockout occurs.  After the user exceeds this value, the user cannot perform any activities until the reset time interval has passed.   A value of zero disables the user lockout functionality.
@@ -429,7 +427,6 @@ Setting_Description_ldap.duplicateMode=Select how @PwmAppName@ handles the situa
 Setting_Description_ldap.edirectory.cr.applyWordlist=Enable this option to prohibit users from using answers in the word list dictionary in answers when the users save the Challenge/Response answers.
 Setting_Description_ldap.edirectory.cr.applyWordlist=Enable this option to prohibit users from using answers in the word list dictionary in answers when the users save the Challenge/Response answers.
 Setting_Description_ldap.edirectory.cr.maxQuestionCharsInAnswer=Specify the maximum number of characters of the question text @PwmAppName@ permits in answers when saving the Challenge/Response answers.
 Setting_Description_ldap.edirectory.cr.maxQuestionCharsInAnswer=Specify the maximum number of characters of the question text @PwmAppName@ permits in answers when saving the Challenge/Response answers.
 Setting_Description_ldap.edirectory.cr.minRandomDuringSetup=Specify the number of random questions you require the users to complete at the time of saving their Challenge/Response answers.
 Setting_Description_ldap.edirectory.cr.minRandomDuringSetup=Specify the number of random questions you require the users to complete at the time of saving their Challenge/Response answers.
-Setting_Description_ldap.edirectory.enableNmas=When connecting to a NetIQ eDirectory LDAP directory, this parameter controls if @PwmAppName@ uses NMAS extensions when connecting to the LDAP directory.  Enabling NMAS results in\:<ul><li>Better error messages when using universal password policies</li><li>Better error handling during certain change password scenarios</li></ul>Unless you are using an older version of eDirectory (pre 8.8 or before), we recommend to set this to true.<br/><br/>All NMAS operations require an SSL connection to the directory.
 Setting_Description_ldap.edirectory.readChallengeSets=Enable this option to have @PwmAppName@ read and apply the challenge set configuration from eDirectory Universal Password policy to users.  If @PwmAppName@ applies an eDirectory challenge set to the user, @PwmAppName@ uses that policy, otherwise @PwmAppName@ uses the policy that is a part of this configuration.  To require only NMAS configured challenge sets, ensure that you blank out the required and forgotten questions as part of this configuration, or else @PwmAppName@ uses those in cases where you have not defined eDirectory policy.
 Setting_Description_ldap.edirectory.readChallengeSets=Enable this option to have @PwmAppName@ read and apply the challenge set configuration from eDirectory Universal Password policy to users.  If @PwmAppName@ applies an eDirectory challenge set to the user, @PwmAppName@ uses that policy, otherwise @PwmAppName@ uses the policy that is a part of this configuration.  To require only NMAS configured challenge sets, ensure that you blank out the required and forgotten questions as part of this configuration, or else @PwmAppName@ uses those in cases where you have not defined eDirectory policy.
 Setting_Description_ldap.edirectory.readUserPwd=Enable this option to have @PwmAppName@ read the user's password from eDirectory before changing it.  This prevents @PwmAppName@ from setting an extra password change to a temporary random password during the forgotten password sequence.  If the proxy user does not have rights to read the password, then @PwmAppName@ generates a temporary random password for the user anyway.
 Setting_Description_ldap.edirectory.readUserPwd=Enable this option to have @PwmAppName@ read the user's password from eDirectory before changing it.  This prevents @PwmAppName@ from setting an extra password change to a temporary random password during the forgotten password sequence.  If the proxy user does not have rights to read the password, then @PwmAppName@ generates a temporary random password for the user anyway.
 Setting_Description_ldap.edirectory.storeNmasResponses=Enable this option to have @PwmAppName@ save user responses to the NMAS response storage container on the user.  This storage is in addition to any other configured response storage methods.
 Setting_Description_ldap.edirectory.storeNmasResponses=Enable this option to have @PwmAppName@ save user responses to the NMAS response storage container on the user.  This storage is in addition to any other configured response storage methods.
@@ -563,6 +560,7 @@ Setting_Description_peopleSearch.enable=Enable this option to enable the People
 Setting_Description_peopleSearch.enablePublic=Enable this option to allow access to the People Search module for unauthenticated users.
 Setting_Description_peopleSearch.enablePublic=Enable this option to allow access to the People Search module for unauthenticated users.
 Setting_Description_peopleSearch.idleTimeout=Specify the number of seconds after which an authenticated session becomes unauthenticated.   If the value is set to 0, then @PwmAppName@ uses then the system-wide idle timeout value.  If a user is using the People Search module without authenticating, then the system does not apply a timeout.
 Setting_Description_peopleSearch.idleTimeout=Specify the number of seconds after which an authenticated session becomes unauthenticated.   If the value is set to 0, then @PwmAppName@ uses then the system-wide idle timeout value.  If a user is using the People Search module without authenticating, then the system does not apply a timeout.
 Setting_Description_peopleSearch.maxCacheSeconds=Specify the number of seconds that @PwmAppName@ caches the results of searches and record details that it reads from eDirectory. Use this setting to control the maximum amount of time @PwmAppName@ can use cached data. Setting to zero disables the cache entirely, but this might negatively impact the scalability of the application and the LDAP directory.
 Setting_Description_peopleSearch.maxCacheSeconds=Specify the number of seconds that @PwmAppName@ caches the results of searches and record details that it reads from eDirectory. Use this setting to control the maximum amount of time @PwmAppName@ can use cached data. Setting to zero disables the cache entirely, but this might negatively impact the scalability of the application and the LDAP directory.
+Setting_Description_peopleSearch.orgChart.assistantAttribute=Specify the attribute that contains the LDAP DN of the assistant for a user.  If this setting is blank, @PwmAppName@ will not show the assistant on the organizational chart view.
 Setting_Description_peopleSearch.orgChart.childAttribute=Specify the attribute that contains the LDAP DN of the direct reports for a user.  If this setting is blank, @PwmAppName@ does not show the organizational chart view.
 Setting_Description_peopleSearch.orgChart.childAttribute=Specify the attribute that contains the LDAP DN of the direct reports for a user.  If this setting is blank, @PwmAppName@ does not show the organizational chart view.
 Setting_Description_peopleSearch.orgChart.parentAttribute=Specify the attribute that contains the LDAP DN of the manager.  If this setting is blank, @PwmAppName@ does not show the organizational chart view.
 Setting_Description_peopleSearch.orgChart.parentAttribute=Specify the attribute that contains the LDAP DN of the manager.  If this setting is blank, @PwmAppName@ does not show the organizational chart view.
 Setting_Description_peopleSearch.photo.ldapAttribute=Specify the LDAP Attribute to use for a photo. Leave this option blank, if you do not want to display a photo.
 Setting_Description_peopleSearch.photo.ldapAttribute=Specify the LDAP Attribute to use for a photo. Leave this option blank, if you do not want to display a photo.
@@ -781,7 +779,6 @@ Setting_Label_display.showHidePasswordFields=Enable Showing Masked Fields
 Setting_Label_display.showLoginPageOptions=Show Login Page Options
 Setting_Label_display.showLoginPageOptions=Show Login Page Options
 Setting_Label_display.showSuccessPage=Show Success Pages
 Setting_Label_display.showSuccessPage=Show Success Pages
 Setting_Label_display.updateAttributes.agreement=Update Profile Agreement Message
 Setting_Label_display.updateAttributes.agreement=Update Profile Agreement Message
-Setting_Label_display.updateAttributes.preferredlanguage=Select your preferred language
 Setting_Label_email.activation=Activation Email
 Setting_Label_email.activation=Activation Email
 Setting_Label_email.activation.token=Activation Verification Email
 Setting_Label_email.activation.token=Activation Verification Email
 Setting_Label_email.adminAlert.toAddress=System Audit Event Email Alerts
 Setting_Label_email.adminAlert.toAddress=System Audit Event Email Alerts
@@ -880,8 +877,6 @@ Setting_Label_helpdesk.verificationMethods=Verification Methods
 Setting_Label_helpdesk.viewStatusValues=Viewable Status Fields
 Setting_Label_helpdesk.viewStatusValues=Viewable Status Fields
 Setting_Label_http.proxy.url=HTTP Proxy
 Setting_Label_http.proxy.url=HTTP Proxy
 Setting_Label_https.server.cert=HTTPS Private Key & Certificate
 Setting_Label_https.server.cert=HTTPS Private Key & Certificate
-Setting_Label_https.server.cert.password=HTTPS Certificate Password
-Setting_Label_https.server.cert.pkcs12=HTTPS Certificate PKCS12
 Setting_Label_https.server.tls.ciphers=TLS Ciphers
 Setting_Label_https.server.tls.ciphers=TLS Ciphers
 Setting_Label_https.server.tls.protocols=TLS Protocols
 Setting_Label_https.server.tls.protocols=TLS Protocols
 Setting_Label_idleTimeoutSeconds=Idle Timeout Seconds
 Setting_Label_idleTimeoutSeconds=Idle Timeout Seconds
@@ -912,7 +907,6 @@ Setting_Label_ldap.duplicateMode=LDAP Duplicate Mode
 Setting_Label_ldap.edirectory.cr.applyWordlist=eDirectory Challenge Set Apply Word List
 Setting_Label_ldap.edirectory.cr.applyWordlist=eDirectory Challenge Set Apply Word List
 Setting_Label_ldap.edirectory.cr.maxQuestionCharsInAnswer=eDirectory Challenge Set Maximum Question Characters In Answer
 Setting_Label_ldap.edirectory.cr.maxQuestionCharsInAnswer=eDirectory Challenge Set Maximum Question Characters In Answer
 Setting_Label_ldap.edirectory.cr.minRandomDuringSetup=eDirectory Challenge Set Minimum Randoms During Setup
 Setting_Label_ldap.edirectory.cr.minRandomDuringSetup=eDirectory Challenge Set Minimum Randoms During Setup
-Setting_Label_ldap.edirectory.enableNmas=Enable NMAS Extensions
 Setting_Label_ldap.edirectory.readChallengeSets=Read eDirectory Challenge Sets
 Setting_Label_ldap.edirectory.readChallengeSets=Read eDirectory Challenge Sets
 Setting_Label_ldap.edirectory.readUserPwd=Read User Passwords
 Setting_Label_ldap.edirectory.readUserPwd=Read User Passwords
 Setting_Label_ldap.edirectory.storeNmasResponses=Save NMAS Responses
 Setting_Label_ldap.edirectory.storeNmasResponses=Save NMAS Responses
@@ -963,7 +957,6 @@ Setting_Label_newUser.redirectUrl=After Registration Redirect URL
 Setting_Label_newUser.sms.verification=Enable New User SMS Verification
 Setting_Label_newUser.sms.verification=Enable New User SMS Verification
 Setting_Label_newUser.token.lifetime=New User Email Token Maximum Lifetime
 Setting_Label_newUser.token.lifetime=New User Email Token Maximum Lifetime
 Setting_Label_newUser.token.lifetime.sms=New User SMS Token Maximum Lifetime
 Setting_Label_newUser.token.lifetime.sms=New User SMS Token Maximum Lifetime
-Setting_Label_newUser.customLinks=Enable New User Custom links
 Setting_Label_newUser.username.definition=LDAP Entry ID Definition
 Setting_Label_newUser.username.definition=LDAP Entry ID Definition
 Setting_Label_newUser.writeAttributes=New User Actions
 Setting_Label_newUser.writeAttributes=New User Actions
 Setting_Label_notes.noteText=Configuration Notes
 Setting_Label_notes.noteText=Configuration Notes
@@ -1047,6 +1040,7 @@ Setting_Label_peopleSearch.enable=Enable People Search
 Setting_Label_peopleSearch.enablePublic=Enable People Search Public (Non-Authenticated) Access
 Setting_Label_peopleSearch.enablePublic=Enable People Search Public (Non-Authenticated) Access
 Setting_Label_peopleSearch.idleTimeout=Idle Timeout Seconds
 Setting_Label_peopleSearch.idleTimeout=Idle Timeout Seconds
 Setting_Label_peopleSearch.maxCacheSeconds=Search Maximum Cache Seconds
 Setting_Label_peopleSearch.maxCacheSeconds=Search Maximum Cache Seconds
+Setting_Label_peopleSearch.orgChart.assistantAttribute=Organizational Assistant Attribute
 Setting_Label_peopleSearch.orgChart.childAttribute=Organizational Chart Child Attribute
 Setting_Label_peopleSearch.orgChart.childAttribute=Organizational Chart Child Attribute
 Setting_Label_peopleSearch.orgChart.parentAttribute=Organizational Chart Parent Attribute
 Setting_Label_peopleSearch.orgChart.parentAttribute=Organizational Chart Parent Attribute
 Setting_Label_peopleSearch.photo.ldapAttribute=LDAP Photo Attribute
 Setting_Label_peopleSearch.photo.ldapAttribute=LDAP Photo Attribute
@@ -1156,7 +1150,6 @@ Setting_Label_updateAttributes.email.verification=Enable Email Verification
 Setting_Label_updateAttributes.enable=Enable Update Profile
 Setting_Label_updateAttributes.enable=Enable Update Profile
 Setting_Label_updateAttributes.forceSetup=Force Update Profile
 Setting_Label_updateAttributes.forceSetup=Force Update Profile
 Setting_Label_updateAttributes.form=Update Profile Form
 Setting_Label_updateAttributes.form=Update Profile Form
-Setting_Label_updateAttributes.preferredlanguage=Update Profile language
 Setting_Label_updateAttributes.profile.list=List of Update Attribute profiles.  In most cases, only a single profile is needed.  Only define multiple profiles if different user populations users will need different features/permissions.  Each profile has a <i>Update Attributes Profile Match</i> setting used to define to whom the profile applies.  If multiple profiles could apply for a user, the first profile in the list defined here will be assigned.
 Setting_Label_updateAttributes.profile.list=List of Update Attribute profiles.  In most cases, only a single profile is needed.  Only define multiple profiles if different user populations users will need different features/permissions.  Each profile has a <i>Update Attributes Profile Match</i> setting used to define to whom the profile applies.  If multiple profiles could apply for a user, the first profile in the list defined here will be assigned.
 Setting_Label_updateAttributes.queryMatch=Update Profile Match
 Setting_Label_updateAttributes.queryMatch=Update Profile Match
 Setting_Label_updateAttributes.showConfirmation=Show Update Profile Confirmation
 Setting_Label_updateAttributes.showConfirmation=Show Update Profile Confirmation

+ 52 - 0
server/src/test/java/password/pwm/config/PwmSettingPropertyTest.java

@@ -0,0 +1,52 @@
+package password.pwm.config;
+
+import org.junit.Assert;
+import org.junit.Test;
+import password.pwm.PwmConstants;
+
+import java.util.HashSet;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+public class PwmSettingPropertyTest {
+
+    @Test
+    public void testForMissingSettings() {
+        final ResourceBundle resourceBundle = ResourceBundle.getBundle(password.pwm.i18n.PwmSetting.class.getName(), PwmConstants.DEFAULT_LOCALE);
+
+        final Set<String> expectedKeys = new HashSet<>();
+
+        for (final PwmSetting pwmSetting : PwmSetting.values()) {
+            final String[] keys = new String[]{
+                    password.pwm.i18n.PwmSetting.SETTING_DESCRIPTION_PREFIX + pwmSetting.getKey(),
+                    password.pwm.i18n.PwmSetting.SETTING_LABEL_PREFIX + pwmSetting.getKey(),
+            };
+            for (final String key : keys) {
+                expectedKeys.add(key);
+                Assert.assertTrue(
+                        "PwmSettings.properties missing record for " + key,
+                        resourceBundle.containsKey(key));
+            }
+        }
+
+        for (final PwmSettingCategory category : PwmSettingCategory.values()) {
+            final String[] keys = new String[]{
+                    password.pwm.i18n.PwmSetting.CATEGORY_DESCRIPTION_PREFIX + category.getKey(),
+                    password.pwm.i18n.PwmSetting.CATEGORY_LABEL_PREFIX + category.getKey(),
+            };
+            for (final String key : keys) {
+                expectedKeys.add(key);
+                Assert.assertTrue(
+                        "PwmSettings.properties missing record for " + key,
+                        resourceBundle.containsKey(key));
+            }
+        }
+
+        final Set<String> extraKeys = new HashSet<>(resourceBundle.keySet());
+        extraKeys.removeAll(expectedKeys);
+
+        if (!extraKeys.isEmpty()) {
+            Assert.fail("unexpected key in PwmSetting.properties file: " + extraKeys.iterator().next());
+        }
+    }
+}