|
|
@@ -49,6 +49,10 @@ class LDAPSettings(Document): |
|
|
|
frappe.throw(_("Custom LDAP Directoy Selected, please ensure 'LDAP Group Member attribute' and 'Group Object Class' are entered"), |
|
|
|
title=_("Misconfigured")) |
|
|
|
|
|
|
|
if self.ldap_custom_group_search and "{0}" not in self.ldap_custom_group_search: |
|
|
|
frappe.throw(_("Custom Group Search if filled needs to contain the user placeholder {0}, eg uid={0},ou=users,dc=example,dc=com"), |
|
|
|
title=_("Misconfigured")) |
|
|
|
|
|
|
|
else: |
|
|
|
frappe.throw(_("LDAP Search String must be enclosed in '()' and needs to contian the user placeholder {0}, eg sAMAccountName={0}")) |
|
|
|
|
|
|
@@ -209,7 +213,10 @@ class LDAPSettings(Document): |
|
|
|
|
|
|
|
ldap_object_class = self.ldap_group_objectclass |
|
|
|
ldap_group_members_attribute = self.ldap_group_member_attribute |
|
|
|
user_search_str = getattr(user, self.ldap_username_field).value |
|
|
|
ldap_custom_group_search = "{0}" |
|
|
|
if self.ldap_custom_group_search: |
|
|
|
ldap_custom_group_search = self.ldap_custom_group_search |
|
|
|
user_search_str = ldap_custom_group_search.format(getattr(user, self.ldap_username_field).value) |
|
|
|
|
|
|
|
else: |
|
|
|
# NOTE: depreciate this else path |
|
|
|