mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-20 02:16:39 +00:00
Stop syncing sources of a connector an admin turned off
Scheduled syncs checked the connection's status but not the admin policy, so a disabled connector kept pulling data. Connector sources now return "disabled" and S3/Reddit syncs get no credentials until the connector is turned back on.
This commit is contained in:
1 parent
2411118048
commit
d9f823d601
3 files changed
+61
-4
No files matched your search
@@ -1200,6 +1200,20 @@ def load_policies(conn) -> dict[str, dict]:
|
||||
return policies
|
||||
|
||||
|
||||
def connector_enabled(conn, row: dict) -> bool:
|
||||
"""Whether an admin left on the connector a connection row belongs to.
|
||||
|
||||
Args:
|
||||
conn: Open database connection.
|
||||
row: A ``connector_sessions`` row.
|
||||
|
||||
Returns:
|
||||
False when the connector (or custom MCP servers) is turned off.
|
||||
"""
|
||||
key = catalog.connector_key_for_row(row)
|
||||
return (load_policies(conn).get(key) or {}).get("enabled") is not False
|
||||
|
||||
|
||||
def ensure_connector_allowed(conn, connector_key: Optional[str]) -> None:
|
||||
"""Refuse a new connection to a connector an admin turned off.
|
||||
|
||||
|
||||
Reference in new issue
Block a user