Skip to content

Commit cfad7b0

Browse files
committed
Address comments
1 parent 324aced commit cfad7b0

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

backend/onyx/configs/app_configs.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,9 @@
360360
ENABLED_CONNECTOR_TYPES = os.environ.get("ENABLED_CONNECTOR_TYPES") or ""
361361

362362
# If set to true, curators can only access and edit assistants that they created
363-
CURATORS_CANNOT_EDIT_NON_OWNED_ASSISTANTS = (
364-
os.environ.get("CURATORS_CANNOT_EDIT_NON_OWNED_ASSISTANTS", "").lower() == "true"
363+
CURATORS_CANNOT_VIEW_OR_EDIT_NON_OWNED_ASSISTANTS = (
364+
os.environ.get("CURATORS_CANNOT_VIEW_OR_EDIT_NON_OWNED_ASSISTANTS", "").lower()
365+
== "true"
365366
)
366367

367368
# Some calls to get information on expert users are quite costly especially with rate limiting

backend/onyx/db/persona.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from sqlalchemy.orm import Session
1616

1717
from onyx.auth.schemas import UserRole
18-
from onyx.configs.app_configs import CURATORS_CANNOT_EDIT_NON_OWNED_ASSISTANTS
18+
from onyx.configs.app_configs import CURATORS_CANNOT_VIEW_OR_EDIT_NON_OWNED_ASSISTANTS
1919
from onyx.configs.app_configs import DISABLE_AUTH
2020
from onyx.configs.chat_configs import BING_API_KEY
2121
from onyx.configs.chat_configs import CONTEXT_CHUNKS_ABOVE
@@ -98,11 +98,11 @@ def _add_user_filters(
9898
return stmt.where(where_clause)
9999

100100
# If curator ownership restriction is enabled, curators can only access their own assistants
101-
if CURATORS_CANNOT_EDIT_NON_OWNED_ASSISTANTS and user.role in [
101+
if CURATORS_CANNOT_VIEW_OR_EDIT_NON_OWNED_ASSISTANTS and user.role in [
102102
UserRole.CURATOR,
103103
UserRole.GLOBAL_CURATOR,
104104
]:
105-
where_clause = Persona.user_id == user.id
105+
where_clause = (Persona.user_id == user.id) | (Persona.user_id.is_(None))
106106
return stmt.where(where_clause)
107107

108108
where_clause = User__UserGroup.user_id == user.id

0 commit comments

Comments
 (0)