浏览代码

feat(ldap): Validate additional required fields.

If the user selects 'Custom' LDAP Directory, when they hit save, validate the additional required fields ('ldap_group_objectclass' and 'ldap_group_member_attribute') for this selection to function.

Issue #13738
version-14
Jon Lockwood 4 年前
父节点
当前提交
3beea20ddd
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. +5
    -0
      frappe/integrations/doctype/ldap_settings/ldap_settings.py

+ 5
- 0
frappe/integrations/doctype/ldap_settings/ldap_settings.py 查看文件

@@ -44,6 +44,11 @@ class LDAPSettings(Document):
frappe.throw(_("Ensure the user and group search paths are correct."), frappe.throw(_("Ensure the user and group search paths are correct."),
title=_("Misconfigured")) title=_("Misconfigured"))


if self.ldap_directory_server.lower() == 'custom':
if not self.ldap_group_member_attribute or not self.ldap_group_mappings_section:
frappe.throw(_("Custom LDAP Directoy Selected, please ensure 'LDAP Group Member attribute' and 'LDAP Group Mappings' are entered"),
title=_("Misconfigured"))

else: else:
frappe.throw(_("LDAP Search String must be enclosed in '()' and needs to contian the user placeholder {0}, eg sAMAccountName={0}")) frappe.throw(_("LDAP Search String must be enclosed in '()' and needs to contian the user placeholder {0}, eg sAMAccountName={0}"))




正在加载...
取消
保存