add superuser decorator, fix restart route and mypy issue

This commit is contained in:
dni ⚡
2022-12-12 09:45:12 +01:00
parent 53af4a4b99
commit ab49b7740c
2 changed files with 13 additions and 4 deletions
+10
View File
@@ -259,3 +259,13 @@ async def check_admin(usr: UUID4) -> User:
user.super_user = True
return user
async def check_super_user(usr: UUID4) -> User:
user = await check_admin(usr)
if user.id != settings.super_user:
raise HTTPException(
status_code=HTTPStatus.UNAUTHORIZED,
detail="User not authorized. No super user privileges.",
)
return user