diff --git a/cps/admin.py b/cps/admin.py index 4fe027a2..7a53c692 100644 --- a/cps/admin.py +++ b/cps/admin.py @@ -564,6 +564,7 @@ def _configuration_ldap_helper(to_save, gdriveError): reboot_required |= _config_string(to_save, "config_ldap_user_object") reboot_required |= _config_string(to_save, "config_ldap_group_object_filter") reboot_required |= _config_string(to_save, "config_ldap_group_members_field") + reboot_required |= _config_string(to_save, "config_ldap_member_user_object") reboot_required |= _config_checkbox(to_save, "config_ldap_openldap") reboot_required |= _config_int(to_save, "config_ldap_encryption") reboot_required |= _config_string(to_save, "config_ldap_cert_path") @@ -598,10 +599,17 @@ def _configuration_ldap_helper(to_save, gdriveError): if config.config_ldap_user_object.count("%s") != 1: return reboot_required, _configuration_result(_('LDAP User Object Filter needs to Have One "%s" Format Identifier'), - gdriveError) + gdriveError) if config.config_ldap_user_object.count("(") != config.config_ldap_user_object.count(")"): return reboot_required, _configuration_result(_('LDAP User Object Filter Has Unmatched Parenthesis'), - gdriveError) + gdriveError) + + if config.config_ldap_member_user_object.count("%s") != 1: + return reboot_required, _configuration_result(_('LDAP Member User Filter needs to Have One "%s" Format Identifier'), + gdriveError) + if config.config_ldap_member_user_object.count("(") != config.config_ldap_member_user_object.count(")"): + return reboot_required, _configuration_result(_('LDAP Member User Filter Has Unmatched Parenthesis'), + gdriveError) if config.config_ldap_cert_path and not os.path.isdir(config.config_ldap_cert_path): return reboot_required, _configuration_result(_('LDAP Certificate Location is not Valid, Please Enter Correct Path'), diff --git a/cps/config_sql.py b/cps/config_sql.py index 1135516d..086d9394 100644 --- a/cps/config_sql.py +++ b/cps/config_sql.py @@ -112,6 +112,7 @@ class _Settings(_Base): config_ldap_cert_path = Column(String, default="") config_ldap_dn = Column(String, default='dc=example,dc=org') config_ldap_user_object = Column(String, default='uid=%s') + config_ldap_member_user_object = Column(String, default='cn=%s') config_ldap_openldap = Column(Boolean, default=True) config_ldap_group_object_filter = Column(String, default='(&(objectclass=posixGroup)(cn=%s))') config_ldap_group_members_field = Column(String, default='memberUid') diff --git a/cps/services/simpleldap.py b/cps/services/simpleldap.py index 0933a933..f11b2324 100644 --- a/cps/services/simpleldap.py +++ b/cps/services/simpleldap.py @@ -64,6 +64,7 @@ def init_app(app, config): app.config['LDAP_OPENLDAP'] = bool(config.config_ldap_openldap) app.config['LDAP_GROUP_OBJECT_FILTER'] = config.config_ldap_group_object_filter app.config['LDAP_GROUP_MEMBERS_FIELD'] = config.config_ldap_group_members_field + app.config['LDAP_MEMBER_USER_OBJECT_FILTER'] = config.config_ldap_member_user_object _ldap.init_app(app) diff --git a/cps/templates/config_edit.html b/cps/templates/config_edit.html index 77a60c1b..b837ebfd 100644 --- a/cps/templates/config_edit.html +++ b/cps/templates/config_edit.html @@ -310,6 +310,10 @@ +