fix: try to except kanidm errors

This commit is contained in:
dettlaff 2024-12-10 20:02:06 +04:00
parent 51a663bc0a
commit d4dada174a

View file

@ -155,7 +155,7 @@ class KanidmUserRepository(AbstractUserRepository):
response = response.json()
if response.get("plugin"):
if response["plugin"]:
if response["plugin"].get("attrunique") == "duplicate value detected":
raise UserAlreadyExists # TODO only user?
@ -165,6 +165,7 @@ class KanidmUserRepository(AbstractUserRepository):
raise KanidmQueryError(f"Kanidm request failed! Error: {str(error)}")
# {"plugin": {"attrunique": "duplicate value detected"}}
# nomatchingentries
@staticmethod
def create_user(