Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Confluence source permission metadata #434

Merged
merged 27 commits into from
Apr 1, 2025

Conversation

shreyanid
Copy link
Contributor

@shreyanid shreyanid commented Mar 20, 2025

Retrieves permission data from each Confluence document and its parent space, normalizes the format (see below), and adds it to the permissions_data field in the metadata.

The output format is a dictionary of roles (read, update, delete) with a lists of "groups" and users" having that permission under each.

"permissions_data": [{
     "read": {
       "groups": [...,],
       "users": [...,], 
     },
     "update": {
       "groups": [...,],
       "users": [...,], 
     },
     "delete": {
       "groups": [...,],
       "users": [...,], 
     },
 }]

The output type is currently wrapped in a list to match the existing FileDataSourceMetadata type definition shared by all connectors. TODO to update that as the other connectors get normalized

The current implementation limits the results to approximately 250 permission entities.

Further improvement items:

  • expand users and groups (apply group permissions as enabled for user of the group)
  • retrieve email based on ID to populate the email_address field
  • enforce the normalized format via the type of permissions_data in FileDataSourceMetadata (instead of a generic list[dict])

This PR also clarifies "space_id" (int) vs "space_key" (str). The previous space_id used throughout the code was actually the space key. Does not change the user facing experience (the space_id field returned in metadata is still the space key as before)

@shreyanid shreyanid changed the title feat(RIVET-662): add Confluence source permission metadata feat: add Confluence source permission metadata Mar 20, 2025
@shreyanid shreyanid force-pushed the confluence_source_permission_metadata branch from c1882a1 to 38214e1 Compare March 24, 2025 16:47
logger.debug(f"Could not retrieve permissions for space {space_id}: {e}")
return None

@requires_dependencies(["requests"], extras="confluence")
Copy link
Contributor

Choose a reason for hiding this comment

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

You refactored this to no longer use requests. I guess it's fine to still use requests and put the import inline.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

either works right? I went ahead with catching a generic exception since we really don't want this to causing jobs to err, so ill remove this dep

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