mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-30 12:46:39 +00:00
fix: kanidm errors comparison
This commit is contained in:
parent
d4dada174a
commit
3bf4cafb0a
|
@ -155,9 +155,11 @@ class KanidmUserRepository(AbstractUserRepository):
|
|||
|
||||
response = response.json()
|
||||
|
||||
if response["plugin"]:
|
||||
if response["plugin"].get("attrunique") == "duplicate value detected":
|
||||
if response and response != []:
|
||||
if response[0]["plugin"].get("attrunique") == "duplicate value detected":
|
||||
raise UserAlreadyExists # TODO only user?
|
||||
else:
|
||||
raise KanidmReturnEmptyResponse
|
||||
|
||||
return response
|
||||
|
||||
|
@ -217,9 +219,6 @@ class KanidmUserRepository(AbstractUserRepository):
|
|||
"""
|
||||
users_data = KanidmUserRepository._send_query(endpoint="person", method="GET")
|
||||
|
||||
if not users_data:
|
||||
raise KanidmReturnEmptyResponse
|
||||
|
||||
users = []
|
||||
for user in users_data:
|
||||
user_attrs = user.get("attrs", {})
|
||||
|
@ -291,9 +290,6 @@ class KanidmUserRepository(AbstractUserRepository):
|
|||
method="GET",
|
||||
)
|
||||
|
||||
if not user_data or "attrs" not in user_data:
|
||||
raise KanidmReturnEmptyResponse
|
||||
|
||||
attrs = user_data["attrs"]
|
||||
|
||||
return UserDataUser(
|
||||
|
@ -319,9 +315,6 @@ class KanidmUserRepository(AbstractUserRepository):
|
|||
method="GET",
|
||||
)
|
||||
|
||||
if not data:
|
||||
raise KanidmReturnEmptyResponse
|
||||
|
||||
token = data.get("token", None)
|
||||
|
||||
if not token:
|
||||
|
|
Loading…
Reference in a new issue