mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
refac
This commit is contained in:
parent
2fee89dfa6
commit
f8b941fb96
@ -124,10 +124,8 @@ async def get_note_by_id(request: Request, id: str, user=Depends(get_verified_us
|
|||||||
status_code=status.HTTP_404_NOT_FOUND, detail=ERROR_MESSAGES.NOT_FOUND
|
status_code=status.HTTP_404_NOT_FOUND, detail=ERROR_MESSAGES.NOT_FOUND
|
||||||
)
|
)
|
||||||
|
|
||||||
if (
|
if (user.role != "admin" and user.id != note.user_id) or (
|
||||||
user.role != "admin"
|
not has_access(user.id, type="read", access_control=note.access_control)
|
||||||
and user.id != note.user_id
|
|
||||||
and not has_access(user.id, type="read", access_control=note.access_control)
|
|
||||||
):
|
):
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.DEFAULT()
|
status_code=status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.DEFAULT()
|
||||||
@ -159,10 +157,8 @@ async def update_note_by_id(
|
|||||||
status_code=status.HTTP_404_NOT_FOUND, detail=ERROR_MESSAGES.NOT_FOUND
|
status_code=status.HTTP_404_NOT_FOUND, detail=ERROR_MESSAGES.NOT_FOUND
|
||||||
)
|
)
|
||||||
|
|
||||||
if (
|
if (user.role != "admin" and user.id != note.user_id) or (
|
||||||
user.role != "admin"
|
not has_access(user.id, type="write", access_control=note.access_control)
|
||||||
and user.id != note.user_id
|
|
||||||
and not has_access(user.id, type="write", access_control=note.access_control)
|
|
||||||
):
|
):
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.DEFAULT()
|
status_code=status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.DEFAULT()
|
||||||
@ -199,10 +195,8 @@ async def delete_note_by_id(request: Request, id: str, user=Depends(get_verified
|
|||||||
status_code=status.HTTP_404_NOT_FOUND, detail=ERROR_MESSAGES.NOT_FOUND
|
status_code=status.HTTP_404_NOT_FOUND, detail=ERROR_MESSAGES.NOT_FOUND
|
||||||
)
|
)
|
||||||
|
|
||||||
if (
|
if (user.role != "admin" and user.id != note.user_id) or (
|
||||||
user.role != "admin"
|
not has_access(user.id, type="write", access_control=note.access_control)
|
||||||
and user.id != note.user_id
|
|
||||||
and not has_access(user.id, type="write", access_control=note.access_control)
|
|
||||||
):
|
):
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.DEFAULT()
|
status_code=status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.DEFAULT()
|
||||||
|
Loading…
Reference in New Issue
Block a user