mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-30 20:56:39 +00:00
fix: get_user_by_username
This commit is contained in:
parent
0f422a6fc8
commit
6d6583ced6
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue