mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-14 10:17:55 +00:00
Hold resumed turns and public-link visitors to the right wiki rules
A paused turn is found by the agent owner's id, so anyone holding one of the owner's agent keys could resume the owner's own chat with its saved wiki edit rights. A resume now counts as an API or widget caller when either the saved state or the resuming request is one, cuts the wiki tool to wiki_view unless the wiki allows outside edits, and gives the tool executor the same flags. A request that names an agent, by key or id, may only resume that agent's turn; otherwise the claim is released and the request refused. Public-link visitors run as themselves and reach only wikis they may edit, so the wiki switch no longer applies to them. Instead every wiki write in a public-link run waits for the visitor's approval, so the agent owner's prompt or sources can't steer an edit to the visitor's wiki unasked.
This commit is contained in:
1 parent
91e70d2f0c
commit
051452c438
10 files changed
+405
-64
No files matched your search
@@ -381,7 +381,7 @@ sources_table = Table(
|
||||
),
|
||||
# Whose account a shared resource runs with: the owner's, or each member's.
|
||||
Column("credential_mode", Text, nullable=False, server_default="owner"),
|
||||
# A wiki's owner lets API, widget and public-link runs edit it (off: read only).
|
||||
# A wiki's owner lets API-key and widget runs edit it (off: read only).
|
||||
Column("wiki_outside_edits", Boolean, nullable=False, server_default="false"),
|
||||
)
|
||||
|
||||
|
||||
@@ -400,7 +400,7 @@ class SourcesRepository:
|
||||
self._conn.execute(stmt)
|
||||
|
||||
def set_wiki_outside_edits(self, source_id: str, user_id: str, allowed: bool) -> bool:
|
||||
"""Record whether API, widget and public-link runs may edit this wiki.
|
||||
"""Record whether API-key and widget runs may edit this wiki.
|
||||
|
||||
Kept out of :meth:`update`'s columns so no route that forwards a
|
||||
request body can change it; only the owner-checked wiki settings
|
||||
|
||||
Reference in new issue
Block a user