Просмотр исходного кода

#742 move memberOf attribute to system.properties

Shinsuke Sugaya 8 лет назад
Родитель
Сommit
6e58cd1299

+ 2 - 0
src/main/java/org/codelibs/fess/Constants.java

@@ -375,6 +375,8 @@ public class Constants extends CoreLibConstants {
 
     public static final String LDAP_ACCOUNT_FILTER = "ldap.account.filter";
 
+    public static final String LDAP_MEMBEROF_ATTRIBUTE = "ldap.memberof.attribute";
+
     public static final String NOTIFICATION_LOGIN = "notification.login";
 
     public static final String NOTIFICATION_SEARCH_TOP = "notification.search.top";

+ 2 - 0
src/main/java/org/codelibs/fess/app/web/admin/general/AdminGeneralAction.java

@@ -152,6 +152,7 @@ public class AdminGeneralAction extends FessAdminAction {
         }
         fessConfig.setLdapBaseDn(form.ldapBaseDn);
         fessConfig.setLdapAccountFilter(form.ldapAccountFilter);
+        fessConfig.setLdapMemberofAttribute(form.ldapMemberofAttribute);
         fessConfig.setNotificationLogin(form.notificationLogin);
         fessConfig.setNotificationSearchTop(form.notificationSearchTop);
 
@@ -193,6 +194,7 @@ public class AdminGeneralAction extends FessAdminAction {
         form.ldapAdminSecurityCredentials = DUMMY_PASSWORD;//fessConfig.getLdapAdminSecurityCredentials();
         form.ldapBaseDn = fessConfig.getLdapBaseDn();
         form.ldapAccountFilter = fessConfig.getLdapAccountFilter();
+        form.ldapMemberofAttribute = fessConfig.getLdapMemberofAttribute();
         form.notificationLogin = fessConfig.getNotificationLogin();
         form.notificationSearchTop = fessConfig.getNotificationSearchTop();
     }

+ 3 - 0
src/main/java/org/codelibs/fess/app/web/admin/general/EditForm.java

@@ -139,6 +139,9 @@ public class EditForm {
     @Size(max = 1000)
     public String ldapAccountFilter;
 
+    @Size(max = 100)
+    public String ldapMemberofAttribute;
+
     @Size(max = 3000)
     public String notificationLogin;
 

+ 6 - 0
src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java

@@ -458,6 +458,9 @@ public class FessLabels extends UserMessages {
     /** The key of the message: Account Filter */
     public static final String LABELS_LDAP_ACCOUNT_FILTER = "{labels.ldapAccountFilter}";
 
+    /** The key of the message: memberOf Attribute */
+    public static final String LABELS_LDAP_MEMBEROF_ATTRIBUTE = "{labels.ldapMemberofAttribute}";
+
     /** The key of the message: Current Password */
     public static final String LABELS_OLD_PASSWORD = "{labels.oldPassword}";
 
@@ -2349,6 +2352,9 @@ public class FessLabels extends UserMessages {
     /** The key of the message: Account Filter */
     public static final String LABELS_ldap_account_filter = "{labels.ldap_account_filter}";
 
+    /** The key of the message: memberOf Attribute */
+    public static final String LABELS_ldap_memberof_attribute = "{labels.ldap_memberof_attribute}";
+
     /** The key of the message: Login page */
     public static final String LABELS_notification_login = "{labels.notification_login}";
 

+ 0 - 15
src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java

@@ -868,9 +868,6 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
     /** The key of the configuration. e.g. -1 */
     String LDAP_MAX_USERNAME_LENGTH = "ldap.max.username.length";
 
-    /** The key of the configuration. e.g. memberOf */
-    String LDAP_MEMBEROF_ATTRIBUTE = "ldap.memberof.attribute";
-
     /** The key of the configuration. e.g. true */
     String LDAP_ROLE_SEARCH_USER_ENABLED = "ldap.role.search.user.enabled";
 
@@ -3793,14 +3790,6 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
      */
     Integer getLdapMaxUsernameLengthAsInteger();
 
-    /**
-     * Get the value for the key 'ldap.memberof.attribute'. <br>
-     * The value is, e.g. memberOf <br>
-     * comment: Active Directory
-     * @return The value of found property. (NotNull: if not found, exception but basically no way)
-     */
-    String getLdapMemberofAttribute();
-
     /**
      * Get the value for the key 'ldap.role.search.user.enabled'. <br>
      * The value is, e.g. true <br>
@@ -5739,10 +5728,6 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
             return getAsInteger(FessConfig.LDAP_MAX_USERNAME_LENGTH);
         }
 
-        public String getLdapMemberofAttribute() {
-            return get(FessConfig.LDAP_MEMBEROF_ATTRIBUTE);
-        }
-
         public String getLdapRoleSearchUserEnabled() {
             return get(FessConfig.LDAP_ROLE_SEARCH_USER_ENABLED);
         }

+ 8 - 0
src/main/java/org/codelibs/fess/mylasta/direction/FessProp.java

@@ -473,6 +473,14 @@ public interface FessProp {
         setSystemProperty(Constants.LDAP_SECURITY_PRINCIPAL, value);
     }
 
+    public default String getLdapMemberofAttribute() {
+        return getSystemProperty(Constants.LDAP_MEMBEROF_ATTRIBUTE, "memberOf");
+    }
+
+    public default void setLdapMemberofAttribute(final String value) {
+        setSystemProperty(Constants.LDAP_MEMBEROF_ATTRIBUTE, value);
+    }
+
     Integer getLdapMaxUsernameLengthAsInteger();
 
     public default String getLdapSecurityPrincipal(final String username) {

+ 0 - 4
src/main/resources/fess_config.properties

@@ -446,10 +446,6 @@ ldap.admin.group.object.classes=groupOfNames
 ldap.admin.sync.password=true
 
 ldap.max.username.length=-1
-# Active Directory
-ldap.memberof.attribute=memberOf
-# OpenDJ
-#ldap.memberof.attribute=isMemberOf
 
 ldap.role.search.user.enabled=true
 ldap.role.search.group.enabled=true

+ 2 - 0
src/main/resources/fess_label.properties

@@ -142,6 +142,7 @@ labels.ldapAdminSecurityPrincipal=Bind DN
 labels.ldapAdminSecurityCredentials=Password
 labels.ldapBaseDn=Base DN
 labels.ldapAccountFilter=Account Filter
+labels.ldapMemberofAttribute=memberOf Attribute
 labels.oldPassword=Current Password
 labels.newPassword=New Password
 labels.confirmNewPassword=New Password(Confirm)
@@ -773,6 +774,7 @@ labels.ldap_admin_security_principal=Bind DN
 labels.ldap_admin_security_credentials=Password
 labels.ldap_base_dn=Base DN
 labels.ldap_account_filter=Account Filter
+labels.ldap_memberof_attribute=memberOf Attribute
 labels.notification_login=Login page
 labels.notification_search_top=Search top page
 labels.send_testmail=Send TestMail

+ 2 - 0
src/main/resources/fess_label_en.properties

@@ -142,6 +142,7 @@ labels.ldapAdminSecurityPrincipal=Bind DN
 labels.ldapAdminSecurityCredentials=Password
 labels.ldapBaseDn=Base DN
 labels.ldapAccountFilter=Account Filter
+labels.ldapMemberofAttribute=memberOf Attribute
 labels.oldPassword=Current Password
 labels.newPassword=New Password
 labels.confirmNewPassword=New Password(Confirm)
@@ -773,6 +774,7 @@ labels.ldap_admin_security_principal=Bind DN
 labels.ldap_admin_security_credentials=Password
 labels.ldap_base_dn=Base DN
 labels.ldap_account_filter=Account Filter
+labels.ldap_memberof_attribute=memberOf Attribute
 labels.notification_login=Login page
 labels.notification_search_top=Search top page
 labels.send_testmail=Send TestMail

+ 2 - 0
src/main/resources/fess_label_ja.properties

@@ -774,7 +774,9 @@ labels.ldap_admin_security_principal=Bind DN
 labels.ldap_admin_security_credentials=\u30d1\u30b9\u30ef\u30fc\u30c9
 labels.ldap_base_dn=Base DN
 labels.ldapAccountFilter=\u30a2\u30ab\u30a6\u30f3\u30c8\u30d5\u30a3\u30eb\u30bf
+labels.ldapMemberofAttribute=memberOf\u5c5e\u6027
 labels.ldap_account_filter=\u30a2\u30ab\u30a6\u30f3\u30c8\u30d5\u30a3\u30eb\u30bf
+labels.ldap_memberof_attribute=memberOf\u5c5e\u6027
 labels.notification_login=\u30ed\u30b0\u30a4\u30f3\u30da\u30fc\u30b8
 labels.notification_search_top=\u691c\u7d22\u30c8\u30c3\u30d7\u30da\u30fc\u30b8
 labels.send_testmail=\u30c6\u30b9\u30c8\u30e1\u30fc\u30eb\u306e\u9001\u4fe1

+ 10 - 0
src/main/webapp/WEB-INF/view/admin/general/admin_general.jsp

@@ -382,6 +382,16 @@
 												styleClass="form-control" />
 										</div>
 									</div>
+									<div class="form-group">
+										<label for="ldapMemberofAttribute"
+											class="col-sm-3 control-label"><la:message
+												key="labels.ldap_memberof_attribute" /></label>
+										<div class="col-sm-9">
+											<la:errors property="ldapMemberofAttribute" />
+											<la:text property="ldapMemberofAttribute"
+												styleClass="form-control" />
+										</div>
+									</div>
 									<%-- Nortification --%>
 									<h4><la:message key="labels.general_menu_notification" /></h4>
 									<div class="form-group">