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,23 +159,22 @@ def update_user(
|
||||||
|
|
||||||
|
|
||||||
def get_user_by_username(username: str) -> UserDataUser:
|
def get_user_by_username(username: str) -> UserDataUser:
|
||||||
user = ACTIVE_USERS_PROVIDER.get_user_by_username(
|
if isinstance(ACTIVE_USERS_PROVIDER, JsonUserRepository):
|
||||||
username=username
|
return ACTIVE_USERS_PROVIDER.get_user_by_username(username=username)
|
||||||
)
|
|
||||||
|
|
||||||
if not isinstance(ACTIVE_USERS_PROVIDER, JsonUserRepository):
|
if username == "root":
|
||||||
if username == "root":
|
return UserDataUser(
|
||||||
return UserDataUser(
|
username="root",
|
||||||
username="root",
|
user_type=UserDataUserOrigin.ROOT,
|
||||||
user_type=UserDataUserOrigin.ROOT,
|
ssh_keys=get_ssh_keys(username="root"),
|
||||||
ssh_keys=get_ssh_keys(username="root"),
|
)
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
user = ACTIVE_USERS_PROVIDER.get_user_by_username(username=username)
|
||||||
if user:
|
|
||||||
user.ssh_keys = get_ssh_keys(username=user.username)
|
try:
|
||||||
except UserNotFound:
|
user.ssh_keys = get_ssh_keys(username=user.username)
|
||||||
pass
|
except UserNotFound:
|
||||||
|
pass
|
||||||
|
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue