mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-05 17:30:30 +00:00
feat: 修改LDAP导入组织问题 (#8111)
Signed-off-by: Jiangjie.Bai <bugatti_it@163.com> Co-authored-by: BaiJiangJie <bugatti_it@163.com>
This commit is contained in:
@@ -81,8 +81,14 @@ def import_ldap_user():
|
||||
util_server = LDAPServerUtil()
|
||||
util_import = LDAPImportUtil()
|
||||
users = util_server.search()
|
||||
org_id = settings.AUTH_LDAP_SYNC_ORG_ID
|
||||
org = Organization.get_instance(org_id)
|
||||
if settings.XPACK_ENABLED:
|
||||
org_id = settings.AUTH_LDAP_SYNC_ORG_ID
|
||||
default_org = None
|
||||
else:
|
||||
# 社区版默认导入Default组织
|
||||
org_id = Organization.DEFAULT_ID
|
||||
default_org = Organization.default()
|
||||
org = Organization.get_instance(org_id, default=default_org)
|
||||
errors = util_import.perform_import(users, org)
|
||||
if errors:
|
||||
logger.error("Imported LDAP users errors: {}".format(errors))
|
||||
|
Reference in New Issue
Block a user