minor: unauthorized exception su message
This commit is contained in:
parent
9d9ca0b907
commit
f44c5b6f36
1 changed files with 2 additions and 2 deletions
|
|
@ -21,7 +21,7 @@ from src.auth.exceptions import UnauthorizedException
|
||||||
def is_super_admin(user_model) -> bool:
|
def is_super_admin(user_model) -> bool:
|
||||||
super_admin_emails = ["chris@sr2.uk"]
|
super_admin_emails = ["chris@sr2.uk"]
|
||||||
if user_model.email not in super_admin_emails:
|
if user_model.email not in super_admin_emails:
|
||||||
raise UnauthorizedException()
|
raise UnauthorizedException(message="Must be super admin")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -65,7 +65,7 @@ async def user_model_super_admin(user_model: user_model_claims_dependency):
|
||||||
if is_super_admin(user_model):
|
if is_super_admin(user_model):
|
||||||
return user_model
|
return user_model
|
||||||
|
|
||||||
raise UnauthorizedException()
|
raise UnauthorizedException(message="Must be super admin")
|
||||||
|
|
||||||
|
|
||||||
super_admin_dependency = Annotated[type[User], Depends(user_model_super_admin)]
|
super_admin_dependency = Annotated[type[User], Depends(user_model_super_admin)]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue