mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
fix: get users
This commit is contained in:
+2
-3
@@ -316,7 +316,7 @@ def get_all_users(query: GetAllUsersQuery):
|
|||||||
"users": [],
|
"users": [],
|
||||||
}
|
}
|
||||||
|
|
||||||
users = UserTable.get_all()
|
users = [u for u in UserTable.get_all()]
|
||||||
is_admin = current_user and "admin" in current_user["roles"]
|
is_admin = current_user and "admin" in current_user["roles"]
|
||||||
settings["enableGuest"] = [
|
settings["enableGuest"] = [
|
||||||
user for user in users if user.username == "guest"
|
user for user in users if user.username == "guest"
|
||||||
@@ -348,8 +348,7 @@ def get_all_users(query: GetAllUsersQuery):
|
|||||||
users = [user for user in users if user.username == "guest"]
|
users = [user for user in users if user.username == "guest"]
|
||||||
|
|
||||||
# reverse list to show latest users first
|
# reverse list to show latest users first
|
||||||
users = list(reversed(users))
|
users = reversed(users)
|
||||||
|
|
||||||
# bring admins to the front
|
# bring admins to the front
|
||||||
users = sorted(users, key=lambda x: "admin" in x.roles, reverse=True)
|
users = sorted(users, key=lambda x: "admin" in x.roles, reverse=True)
|
||||||
# bring current user to index 0
|
# bring current user to index 0
|
||||||
|
|||||||
Reference in New Issue
Block a user