feat: ldap一键导入及设置用户组织

This commit is contained in:
feng626
2022-04-01 15:33:14 +08:00
committed by Jiangjie.Bai
parent ef36b2e662
commit c8758f417d
5 changed files with 17 additions and 9 deletions

View File

@@ -195,7 +195,9 @@ class LDAPUserImportAPI(APIView):
def get_ldap_users(self):
username_list = self.request.data.get('username_list', [])
cache_police = self.request.query_params.get('cache_police', True)
if cache_police in LDAP_USE_CACHE_FLAGS:
if '*' in username_list:
users = LDAPServerUtil().search()
elif cache_police in LDAP_USE_CACHE_FLAGS:
users = LDAPCacheUtil().search(search_users=username_list)
else:
users = LDAPServerUtil().search(search_users=username_list)
@@ -234,4 +236,3 @@ class LDAPCacheRefreshAPI(generics.RetrieveAPIView):
logger.error(str(e))
return Response(data={'msg': str(e)}, status=400)
return Response(data={'msg': 'success'})