feat: course authoring automatic migration#259
Conversation
|
Thanks for the pull request, @BryanttV! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
248c2ab to
03a33e8
Compare
0665267 to
639be47
Compare
b307678 to
05ae570
Compare
|
Note to the reviewer: I was running tests to verify that the Footnotes |
dwong2708
left a comment
There was a problem hiding this comment.
Impressive work. Just a couple of comments. Thanks!
mariajgrimaldi
left a comment
There was a problem hiding this comment.
Thanks a lot for all the effort!
8048c22 to
dca9107
Compare
…ing flag overrides
…nd previous record states
ab1b229 to
fb803ac
Compare
rodmgwgu
left a comment
There was a problem hiding this comment.
Thanks for all this work!
dwong2708
left a comment
There was a problem hiding this comment.
LGTM! Great job on this.
mariajgrimaldi
left a comment
There was a problem hiding this comment.
LGTM!
Let's not forget to document this thoroughly for operators ;) thanks all!
Closes: #223
Description
This PR implements the automatic course authoring migration feature, which triggers a migration between the legacy
CourseAccessRolesystem and the new AuthZ (Casbin-based) system whenever theauthz.enable_course_authoringwaffle flag is toggled for a course or organization.Changes
New Model:
AuthzCourseAuthoringMigrationRunrunning,completed,partial_success,failed,skipped.courseororg.New Core Function:
run_course_authoring_migrationtransaction.atomic()to create the tracking record atomically. AnIntegrityErrorfrom the unique constraint skips the run instead of crashing.migrate_legacy_course_roles_to_authz(forward) ormigrate_authz_to_legacy_course_roles(rollback).failed(outside the inner transaction, so the tracking record is always persisted).Signal Handlers
post_savesignals fromWaffleFlagCourseOverrideModelandWaffleFlagOrgOverrideModel.handle_course_waffle_flag_change/handle_org_waffle_flag_change→ delegate totrigger_course_authoring_migration.trigger_course_authoring_migration:ENABLE_AUTOMATIC_AUTHZ_COURSE_AUTHORING_MIGRATION = False.FORWARDwhen flag is enabled,ROLLBACKwhen disabled.New Setting
ENABLE_AUTOMATIC_AUTHZ_COURSE_AUTHORING_MIGRATIONdefaults toFalse. Must be explicitly opted in to activate automatic migrations.Testing Instructions
Related PR
Merge checklist
Check off if complete or not applicable: