diff --git a/selfprivacy_api/graphql/mutations/users_mutations.py b/selfprivacy_api/graphql/mutations/users_mutations.py index fd801d1..229529d 100644 --- a/selfprivacy_api/graphql/mutations/users_mutations.py +++ b/selfprivacy_api/graphql/mutations/users_mutations.py @@ -101,8 +101,6 @@ class UsersMutations: UsernameTooLong, InvalidConfiguration, KanidmDidNotReturnAdminPassword, - KanidmReturnUnknownResponseType, - KanidmReturnEmptyResponse, KanidmQueryError, ) as error: return return_failed_mutation_return( @@ -177,8 +175,6 @@ class UsersMutations: PasswordIsEmpty, SelfPrivacyAppIsOutdate, KanidmDidNotReturnAdminPassword, - KanidmReturnUnknownResponseType, - KanidmReturnEmptyResponse, KanidmQueryError, ) as error: return return_failed_mutation_return( diff --git a/selfprivacy_api/repositories/users/kanidm_user_repository.py b/selfprivacy_api/repositories/users/kanidm_user_repository.py index 1ca844b..aab6e0c 100644 --- a/selfprivacy_api/repositories/users/kanidm_user_repository.py +++ b/selfprivacy_api/repositories/users/kanidm_user_repository.py @@ -102,20 +102,22 @@ class KanidmAdminToken: # TODO CHECK IS TOKEN CORRECT? class KanidmUserRepository(AbstractUserRepository): - """ - Validates the type and that content of the response data is not empty. - - Args: - data_type (str): Expected type of response data ('list' or 'dict'). - response_data (any): Response data to validate. - - Raises: - KanidmReturnEmptyResponse: If the response data is empty. - KanidmReturnUnknownResponseType: If the response data is not of the expected type. - """ - @staticmethod def _check_response_type_and_not_empty(data_type: str, response_data: Any) -> None: + """ + Validates the type and that content of the response data is not empty. + + Args: + data_type (str): Expected type of response data ('list' or 'dict'). + response_data (any): Response data to validate. + + Raises: + KanidmReturnEmptyResponse: If the response data is empty. + KanidmReturnUnknownResponseType: If the response data is not of the expected type. + """ + + logging.info(response_data) + if data_type == "list": if not isinstance(response_data, list): raise KanidmReturnUnknownResponseType(response_data=response_data) @@ -128,9 +130,6 @@ class KanidmUserRepository(AbstractUserRepository): if not response_data.get("data"): raise KanidmReturnEmptyResponse - else: - raise KanidmReturnUnknownResponseType(response_data=response_data) - @staticmethod def _check_user_origin_by_memberof( memberof: list[str] = [], @@ -173,8 +172,6 @@ class KanidmUserRepository(AbstractUserRepository): raise KanidmQueryError(error_text=response.text) - # nomatchingentries - @staticmethod def create_user( username: str,