Skip to content

Conversation

Weves
Copy link
Contributor

@Weves Weves commented Jul 1, 2025

Description

Fixes https://linear.app/danswer/issue/DAN-2154/allow-curators-to-create-public-connectors-document-sets

How Has This Been Tested?

Locally created connectors/document sets as a curator.

Backporting (check the box to trigger backport action)

Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.

  • This PR should be backported (make sure to check that the backport attempt succeeds)
  • [Optional] Override Linear Check

@Weves Weves requested a review from a team as a code owner July 1, 2025 02:53
Copy link

vercel bot commented Jul 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 9, 2025 5:31pm

@Weves Weves force-pushed the extend-curator branch from 30a8269 to e0abe3d Compare July 1, 2025 02:53
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Extends permissions to allow curators to create and manage public connectors and document sets, with significant changes across both frontend and backend components.

  • Modified backend/ee/onyx/db/user_group.py to allow curators to create public objects through new ownership validation in validate_object_creation_for_user
  • Added object ownership validation in backend/onyx/server/documents/connector.py and cc_pair.py to verify creator permissions before updates
  • Improved IsPublicGroupSelector component to handle curator-specific logic without blocking when no groups are available
  • Fixed a potential security concern in CreateCredential.tsx with temporary debugging code that should be removed before production
  • Added proper error handling and existence checks in document set API endpoints with nullable user parameter support

13 files reviewed, 5 comments
Edit PR Review Bot Settings | Greptile

Comment on lines +632 to +639
def fetch_connector_credential_pair_for_connector(
db_session: Session,
connector_id: int,
) -> ConnectorCredentialPair | None:
stmt = select(ConnectorCredentialPair).where(
ConnectorCredentialPair.connector_id == connector_id,
)
return db_session.scalar(stmt)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: This function will only return one random CC pair if multiple exist for the connector. Add ORDER BY clause or handle multiple results explicitly

) {
formikProps.setFieldValue("authentication_method", authMethod);
}
console.log(formikProps.isSubmitting);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: remove debug console.log before merging to production

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true

Comment on lines +149 to +156
# Allow curators and global curators to create public objects
# w/o associated groups IF the object is new/owned by them
if (
object_is_public
and user.role in [UserRole.CURATOR, UserRole.GLOBAL_CURATOR]
and (object_is_new or object_is_owned_by_user)
):
return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: explicitly check for None to avoid potential false negatives if object_is_new/object_is_owned_by_user is False

def patch_document_set(
document_set_update_request: DocumentSetUpdateRequest,
user: User = Depends(current_curator_or_admin_user),
user: User | None = Depends(current_curator_or_admin_user),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: The 'user' parameter is marked as nullable (User | None) but current_curator_or_admin_user should never return None. This could cause confusion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

greptile is wrong and we should probably make sure it's User | None everywhere

Comment on lines +120 to +121
"onyx.db.user_group", "validate_object_creation_for_user", None
)(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Function name 'validate_object_creation_for_user' is misleading since it's being used for deletion validation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be worth leaving a comment explaining

Copy link
Contributor

@evan-onyx evan-onyx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couple nits

object_is_public: bool | None = None,
object_is_perm_sync: bool | None = None,
object_is_owned_by_user: bool | None = None,
object_is_new: bool | None = None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo better to make all these default to False unless we truly need a ternary value

def patch_document_set(
document_set_update_request: DocumentSetUpdateRequest,
user: User = Depends(current_curator_or_admin_user),
user: User | None = Depends(current_curator_or_admin_user),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

greptile is wrong and we should probably make sure it's User | None everywhere

Comment on lines +120 to +121
"onyx.db.user_group", "validate_object_creation_for_user", None
)(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be worth leaving a comment explaining

) {
formikProps.setFieldValue("authentication_method", authMethod);
}
console.log(formikProps.isSubmitting);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true

@Weves Weves merged commit f0ed063 into main Jul 9, 2025
14 checks passed
@Weves Weves deleted the extend-curator branch July 9, 2025 18:38
AnkitTukatek pushed a commit to TukaTek/onyx that referenced this pull request Sep 23, 2025
…app#4972)

* Allow curators to create public connectors / document sets

* Address EL comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants