Kaynağa Gözat

HUE-8053 [useradmin] LDAP authentication with sync_groups_on_login=true fails with KeyError exception

Ben Gooley 7 yıl önce
ebeveyn
işleme
68b323c
1 değiştirilmiş dosya ile 6 ekleme ve 1 silme
  1. 6 1
      apps/useradmin/src/useradmin/views.py

+ 6 - 1
apps/useradmin/src/useradmin/views.py

@@ -943,7 +943,12 @@ def _import_ldap_users_info(connection, user_info, sync_groups=False, import_by_
         new_groups = set()
         current_ldap_groups = set()
 
-        ldap_config = desktop.conf.LDAP.LDAP_SERVERS.get()[server] if server else desktop.conf.LDAP
+        if desktop.conf.LDAP.LDAP_SERVERS.get():
+          # Choose from multiple server configs
+          ldap_config = desktop.conf.LDAP.LDAP_SERVERS.get()[server]
+        else:
+          ldap_config = desktop.conf.LDAP
+
         group_member_attr = ldap_config.GROUPS.GROUP_MEMBER_ATTR.get()
         group_filter = ldap_config.GROUPS.GROUP_FILTER.get()
         # Search for groups based on group_member_attr=username and group_member_attr=dn