mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: additional verification for anon users
This commit is contained in:
parent
3c2f6b3a98
commit
42c99f3939
9 changed files with 46 additions and 4 deletions
|
|
@ -79,7 +79,6 @@ async def authorization_verify_based_on_roles(
|
|||
element_id: str,
|
||||
):
|
||||
element_type = await check_element_type(element_id)
|
||||
print(element_type)
|
||||
element = request.app.db[element_type]
|
||||
roles = request.app.db["roles"]
|
||||
|
||||
|
|
@ -125,3 +124,11 @@ async def authorization_verify_based_on_roles_and_authorship(
|
|||
status_code=status.HTTP_403_FORBIDDEN,
|
||||
detail="User rights (roles & authorship) : You don't have the right to perform this action",
|
||||
)
|
||||
|
||||
|
||||
async def authorization_verify_if_user_is_anon(user_id: str):
|
||||
if user_id == "anonymous":
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_403_FORBIDDEN,
|
||||
detail="You should be logged in to perform this action",
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue