From 33f491d4f6f04f0ee913f48ae78403b8460c017f Mon Sep 17 00:00:00 2001 From: dettlaff Date: Wed, 11 Dec 2024 13:27:58 +0400 Subject: [PATCH] feat: add response_data == "nomatchingentries" --- selfprivacy_api/repositories/users/exceptions.py | 2 +- selfprivacy_api/repositories/users/kanidm_user_repository.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/selfprivacy_api/repositories/users/exceptions.py b/selfprivacy_api/repositories/users/exceptions.py index 7f39654..6444342 100644 --- a/selfprivacy_api/repositories/users/exceptions.py +++ b/selfprivacy_api/repositories/users/exceptions.py @@ -11,7 +11,7 @@ class UserIsProtected(Exception): @staticmethod def get_error_message() -> str: - return "User is protected and cannot be deleted" + return "User is protected and cannot be deleted or modified" class UsernameForbidden(Exception): diff --git a/selfprivacy_api/repositories/users/kanidm_user_repository.py b/selfprivacy_api/repositories/users/kanidm_user_repository.py index 637e631..5533f5e 100644 --- a/selfprivacy_api/repositories/users/kanidm_user_repository.py +++ b/selfprivacy_api/repositories/users/kanidm_user_repository.py @@ -166,6 +166,9 @@ class KanidmUserRepository(AbstractUserRepository): if plugin_error.get("attrunique") == "duplicate value detected": raise UserAlreadyExists # TODO only user ? + if isinstance(response_data, str) and response_data == "nomatchingentries": + raise UserNotFound # is it works only for user? + raise KanidmQueryError(error_text=response.text) return response_data