-
Notifications
You must be signed in to change notification settings - Fork 0
feat: platform roles reworked (AAI-467) #114
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
Conversation
…s to be there from the start
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
amandazhuyilan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - nothing standing out to me, lets merge it and see!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements platform role management by adding support for platform-specific Auth0 roles, syncing platform memberships from Auth0, and updating the registration flows to use these roles. The changes enable platforms to have associated Auth0 roles that grant access, and introduce auto-approval logic for both group and platform memberships.
Key changes:
- Added platform role support with database schema migration and sync tasks
- Refactored biocommons registration to use bundle configuration with auto-approval settings
- Updated all registration endpoints to assign Auth0 roles when auto-approving platform memberships
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
migrations/versions/4594b458279c_platform_roles.py |
Adds migration for platform role_id foreign key |
schemas/auth0.py |
New file with regex patterns and helpers to extract platform/group IDs from Auth0 role names |
db/models.py |
Adds platform_role relationship, role assignment methods, and platform creation from Auth0 roles |
scheduled_tasks/tasks.py |
Splits user-role sync into separate group and platform membership syncs, adds platform population task |
scheduled_tasks/scheduler.py |
Uses MemoryJobStore for SQLite to avoid locking issues |
run_scheduler.py |
Adds new sync_platform_user_roles and populate_platforms_from_auth0 scheduled jobs |
routers/biocommons_register.py |
Refactors to use BiocommonsBundle class with configurable auto-approval for groups/platforms |
routers/biocommons_admin.py |
Adds endpoint to set platform admin roles and updates platform creation to include role_name |
routers/galaxy_register.py |
Updates to pass auth0_client when creating platform memberships |
routers/bpa_register.py |
Updates to pass auth0_client when creating platform memberships |
routers/sbp_register.py |
Updates to pass auth0_client when creating platform memberships |
tests/test_biocommons_register.py |
Updates tests to use bundle.create_user_record and adds platform fixtures |
tests/test_biocommons_admin.py |
Adds tests for set_admin_roles endpoint and galaxy_platform fixture |
tests/test_galaxy.py |
Adds galaxy_platform fixture for tests |
tests/test_bpa_register.py |
Adds bpa_platform fixture for tests |
tests/test_sbp_register.py |
Adds sbp_platform fixture for tests |
tests/test_admin_user_filters.py |
Updates to use PlatformMembershipFactory instead of add_platform_membership |
tests/scheduled_tasks/test_tasks.py |
Renames sync function tests and adds test for platform membership sync |
tests/db/test_models.py |
Updates platform creation tests to include required role_name |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ons/aai-backend into feature/platform-roles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 12 comments.
amandazhuyilan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved!
Description
AAI-467: reworking #112 . linking roles to platforms via ID this time, so we don't run into the same issue with migrations. Have also added default admin roles to Auth0 via the infra deployment code, so each platform should have an associated admin role.
Changes
How to test
Run
uv run pytest