feat: add response_data == "nomatchingentries"

This commit is contained in:
dettlaff 2024-12-11 13:27:58 +04:00
parent eca12a3079
commit 33f491d4f6
2 changed files with 4 additions and 1 deletions

View file

@ -11,7 +11,7 @@ class UserIsProtected(Exception):
@staticmethod @staticmethod
def get_error_message() -> str: 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): class UsernameForbidden(Exception):

View file

@ -166,6 +166,9 @@ class KanidmUserRepository(AbstractUserRepository):
if plugin_error.get("attrunique") == "duplicate value detected": if plugin_error.get("attrunique") == "duplicate value detected":
raise UserAlreadyExists # TODO only user ? 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) raise KanidmQueryError(error_text=response.text)
return response_data return response_data