소스 검색

fix issue with out-of-order settings in config editor

Jason Rivard 4 년 전
부모
커밋
d235fe272a

+ 1 - 1
server/src/main/java/password/pwm/http/servlet/configeditor/data/SettingData.java

@@ -36,6 +36,6 @@ public class SettingData implements Serializable
     private final Map<String, LocaleInfo> locales;
     private final Object ldapProfileIds;
     private final PwmSettingTemplateSet currentTemplate;
-    private final SettingDataMaker.VarData var;
+    private final VarData var;
 
 }

+ 10 - 14
server/src/main/java/password/pwm/http/servlet/configeditor/data/SettingDataMaker.java

@@ -20,8 +20,6 @@
 
 package password.pwm.http.servlet.configeditor.data;
 
-import lombok.Builder;
-import lombok.Value;
 import password.pwm.bean.SessionLabel;
 import password.pwm.config.PwmSetting;
 import password.pwm.config.PwmSettingCategory;
@@ -36,7 +34,7 @@ import password.pwm.util.logging.PwmLogger;
 import java.time.Instant;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.List;
+import java.util.LinkedHashMap;
 import java.util.Locale;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -59,17 +57,23 @@ public class SettingDataMaker
         final Map<String, SettingInfo> settingMap = Collections.unmodifiableMap( Arrays.stream( PwmSetting.values() )
                 .collect( Collectors.toMap(
                         PwmSetting::getKey,
-                        pwmSetting -> SettingInfo.forSetting( pwmSetting, templateSet, locale ) ) ) );
+                        pwmSetting -> SettingInfo.forSetting( pwmSetting, templateSet, locale ),
+                        ( u, v ) -> v,
+                        LinkedHashMap::new ) ) );
 
         final Map<String, CategoryInfo> categoryInfoMap = Collections.unmodifiableMap( Arrays.stream( PwmSettingCategory.values() )
                 .collect( Collectors.toMap(
                         PwmSettingCategory::getKey,
-                        pwmSettingCategory -> CategoryInfo.forCategory( pwmSettingCategory, locale ) ) ) );
+                        pwmSettingCategory -> CategoryInfo.forCategory( pwmSettingCategory, locale ),
+                        ( u, v ) -> v,
+                        LinkedHashMap::new ) ) );
 
         final Map<String, LocaleInfo> labelMap = Collections.unmodifiableMap( Arrays.stream( PwmLocaleBundle.values() )
                 .collect( Collectors.toMap(
                         pwmLocaleBundle ->  pwmLocaleBundle.getTheClass().getSimpleName(),
-                        LocaleInfo::forBundle ) ) );
+                        LocaleInfo::forBundle,
+                        ( u, v ) -> v,
+                        LinkedHashMap::new ) ) );
 
         final VarData varMap = VarData.builder()
                 .ldapProfileIds( ValueTypeConverter.valueToStringArray( storedConfiguration.readSetting( PwmSetting.LDAP_PROFILE_LIST, null ) ) )
@@ -89,12 +93,4 @@ public class SettingDataMaker
 
         return settingData;
     }
-
-    @Value
-    @Builder
-    static class VarData
-    {
-        private final List<String> ldapProfileIds;
-        private final PwmSettingTemplateSet currentTemplate;
-    }
 }

+ 36 - 0
server/src/main/java/password/pwm/http/servlet/configeditor/data/VarData.java

@@ -0,0 +1,36 @@
+/*
+ * Password Management Servlets (PWM)
+ * http://www.pwm-project.org
+ *
+ * Copyright (c) 2006-2009 Novell, Inc.
+ * Copyright (c) 2009-2020 The PWM Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package password.pwm.http.servlet.configeditor.data;
+
+import lombok.Builder;
+import lombok.Value;
+import password.pwm.config.PwmSettingTemplateSet;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Value
+@Builder
+public class VarData implements Serializable
+{
+    private final List<String> ldapProfileIds;
+    private final PwmSettingTemplateSet currentTemplate;
+}