From 2e5a8c8b7ba8c28d678dcf00b04e35f2241a936b Mon Sep 17 00:00:00 2001 From: dettlaff Date: Thu, 19 Dec 2024 05:03:25 +0400 Subject: [PATCH] fix: delete unnecessary call --- selfprivacy_api/actions/users.py | 16 +++++++--------- .../repositories/users/kanidm_user_repository.py | 3 +-- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/selfprivacy_api/actions/users.py b/selfprivacy_api/actions/users.py index e9a83b9..9a897b3 100644 --- a/selfprivacy_api/actions/users.py +++ b/selfprivacy_api/actions/users.py @@ -145,10 +145,13 @@ def update_user( if username == "root": raise UserIsProtected - if ( - displayname and len(displayname) >= 512 - ): # we don't know the limitations of each service - raise DisplaynameTooLong + if displayname: + if len(displayname) >= 512: # we don't know the limitations of each service + raise DisplaynameTooLong + ACTIVE_USERS_PROVIDER.update_user( + username=username, + displayname=displayname, + ) if directmemberof: user = ACTIVE_USERS_PROVIDER.get_user_by_username(username=username) @@ -176,11 +179,6 @@ def update_user( group_name=group, users=[username] ) - ACTIVE_USERS_PROVIDER.update_user( - username=username, - displayname=displayname, - ) - def get_user_by_username(username: str) -> UserDataUser: if isinstance(ACTIVE_USERS_PROVIDER, JsonUserRepository): diff --git a/selfprivacy_api/repositories/users/kanidm_user_repository.py b/selfprivacy_api/repositories/users/kanidm_user_repository.py index b7324cd..14fa974 100644 --- a/selfprivacy_api/repositories/users/kanidm_user_repository.py +++ b/selfprivacy_api/repositories/users/kanidm_user_repository.py @@ -31,7 +31,7 @@ from selfprivacy_api.repositories.users.abstract_user_repository import ( REDIS_TOKEN_KEY = "kanidm:token" KANIDM_URL = "https://127.0.0.1:3013" -ADMIN_GROUPS = ["sp.admin"] +ADMIN_GROUPS = ["idm_admins"] redis = RedisPool().get_connection() @@ -450,7 +450,6 @@ class KanidmUserRepository(AbstractUserRepository): data = { "attrs": { "mail": [f"{username}@{get_domain()}"], - "class": ["user"], # TODO read more about it } }