mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-13 21:05:19 +00:00
refac
This commit is contained in:
parent
9b84a8e443
commit
d509ca1133
1 changed files with 12 additions and 4 deletions
|
|
@ -353,8 +353,12 @@ async def yjs_document_join(sid, data):
|
||||||
log.error(f"Note {note_id} not found")
|
log.error(f"Note {note_id} not found")
|
||||||
return
|
return
|
||||||
|
|
||||||
if user.get("role") != "admin" and has_access(
|
if (
|
||||||
|
user.get("role") != "admin"
|
||||||
|
and user.get("id") != note.user_id
|
||||||
|
and not has_access(
|
||||||
user.get("id"), type="read", access_control=note.access_control
|
user.get("id"), type="read", access_control=note.access_control
|
||||||
|
)
|
||||||
):
|
):
|
||||||
log.error(
|
log.error(
|
||||||
f"User {user.get('id')} does not have access to note {note_id}"
|
f"User {user.get('id')} does not have access to note {note_id}"
|
||||||
|
|
@ -424,8 +428,12 @@ async def document_save_handler(document_id, data, user):
|
||||||
log.error(f"Note {note_id} not found")
|
log.error(f"Note {note_id} not found")
|
||||||
return
|
return
|
||||||
|
|
||||||
if user.get("role") != "admin" and has_access(
|
if (
|
||||||
|
user.get("role") != "admin"
|
||||||
|
and user.get("id") != note.user_id
|
||||||
|
and not has_access(
|
||||||
user.get("id"), type="read", access_control=note.access_control
|
user.get("id"), type="read", access_control=note.access_control
|
||||||
|
)
|
||||||
):
|
):
|
||||||
log.error(f"User {user.get('id')} does not have access to note {note_id}")
|
log.error(f"User {user.get('id')} does not have access to note {note_id}")
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue