fix: get_user_by_username

This commit is contained in:
dettlaff 2024-12-11 12:22:52 +04:00
parent 0f422a6fc8
commit 6d6583ced6

View file

@ -159,11 +159,9 @@ def update_user(
def get_user_by_username(username: str) -> UserDataUser:
user = ACTIVE_USERS_PROVIDER.get_user_by_username(
username=username
)
if isinstance(ACTIVE_USERS_PROVIDER, JsonUserRepository):
return ACTIVE_USERS_PROVIDER.get_user_by_username(username=username)
if not isinstance(ACTIVE_USERS_PROVIDER, JsonUserRepository):
if username == "root":
return UserDataUser(
username="root",
@ -171,8 +169,9 @@ def get_user_by_username(username: str) -> UserDataUser:
ssh_keys=get_ssh_keys(username="root"),
)
user = ACTIVE_USERS_PROVIDER.get_user_by_username(username=username)
try:
if user:
user.ssh_keys = get_ssh_keys(username=user.username)
except UserNotFound:
pass