File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 360
360
ENABLED_CONNECTOR_TYPES = os .environ .get ("ENABLED_CONNECTOR_TYPES" ) or ""
361
361
362
362
# 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"
365
366
)
366
367
367
368
# Some calls to get information on expert users are quite costly especially with rate limiting
Original file line number Diff line number Diff line change 15
15
from sqlalchemy .orm import Session
16
16
17
17
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
19
19
from onyx .configs .app_configs import DISABLE_AUTH
20
20
from onyx .configs .chat_configs import BING_API_KEY
21
21
from onyx .configs .chat_configs import CONTEXT_CHUNKS_ABOVE
@@ -98,11 +98,11 @@ def _add_user_filters(
98
98
return stmt .where (where_clause )
99
99
100
100
# 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 [
102
102
UserRole .CURATOR ,
103
103
UserRole .GLOBAL_CURATOR ,
104
104
]:
105
- where_clause = Persona .user_id == user .id
105
+ where_clause = ( Persona .user_id == user .id ) | ( Persona . user_id . is_ ( None ))
106
106
return stmt .where (where_clause )
107
107
108
108
where_clause = User__UserGroup .user_id == user .id
You can’t perform that action at this time.
0 commit comments