mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: collections bugs
This commit is contained in:
parent
9c1fb565af
commit
46e09f27c2
2 changed files with 20 additions and 17 deletions
|
|
@ -33,19 +33,18 @@ async def authorization_verify_if_element_is_public(
|
|||
detail="User rights : You don't have the right to perform this action",
|
||||
)
|
||||
|
||||
if element_nature == "collections" and action == "read":
|
||||
|
||||
statement = select(Collection).where(
|
||||
Collection.public == True, Collection.collection_uuid == element_uuid
|
||||
if element_nature == "collections" and action == "read":
|
||||
statement = select(Collection).where(
|
||||
Collection.public == True, Collection.collection_uuid == element_uuid
|
||||
)
|
||||
collection = db_session.exec(statement).first()
|
||||
if collection:
|
||||
return True
|
||||
else:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_403_FORBIDDEN,
|
||||
detail="User rights : You don't have the right to perform this action",
|
||||
)
|
||||
collection = db_session.exec(statement).first()
|
||||
if collection:
|
||||
return True
|
||||
else:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_403_FORBIDDEN,
|
||||
detail="User rights : You don't have the right to perform this action",
|
||||
)
|
||||
else:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_403_FORBIDDEN,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue