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

[#10915] Break course CRUD permission into edit, delete and restore permissions #11029

Conversation

daongochieu2810
Copy link
Contributor

@daongochieu2810 daongochieu2810 commented Mar 11, 2021

Part of #10915

Outline of Solution

  • FE:
    • Break the checkbox of Edit/Delete/Restore Course into Edit Course, Delete Course and Restore Course checkboxes
    • Disable/Enable Restore, Edit and Delete buttons based on specific permissions
    • Update related tests and update snapshots
  • BE:
    • Break the CAN_MODIFY_COURSE permission into CAN_EDIT_COURSE, CAN_DELETE_COURSE, and CAN_RESTORE_COURSE permissions
    • Change modify course permission to more specific permission for UpdateCourseAction, BinCourseAction and RestoreCourseAction
    • Update related tests and json test data

@daongochieu2810 daongochieu2810 added the s.ToReview The PR is waiting for review(s) label Mar 11, 2021
Copy link
Contributor

@madanalogy madanalogy left a comment

Choose a reason for hiding this comment

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

This is quite a massive PR, only went through half the files so far hang on for the rest. Preliminary comment below

Copy link
Contributor

@madanalogy madanalogy left a comment

Choose a reason for hiding this comment

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

Changes looks good to me! We'll give it a few weeks to see if anyone else has the bandwidth for a second review. Actually, now that I think about it, I'm not really sure how these changes will affect instructors already present in the system. @wkurniawan07 @xpdavid any idea whether we might need a data migration for changes to instructor privileges?

@madanalogy madanalogy added s.FinalReview The PR is ready for final review and removed s.ToReview The PR is waiting for review(s) labels Mar 13, 2021
@rrtheonlyone
Copy link
Contributor

Note that this is not a backwards compatible change.

As of now the privileges are just serialised and stored as a JSON string. We have instructors with permission CAN_MODIFY_COURSE at the moment in our database. After this change, those instructors will not be able to update/delete/restore course anymore.

I am guessing our two options are:

  • we somehow account for both CAN_MODIFY_COURSE and those fine-grained ones in our actions
  • write a script to migrate CAN_MODIFY_COURSE into all of those fine-grained ones above

Also, I am wondering if there is a need for the above change. Yes, fine-grained control is nice to have for courses but the same can be said for sessions/instructors/students etc.

@madanalogy
Copy link
Contributor

Also, I am wondering if there is a need for the above change. Yes, fine-grained control is nice to have for courses but the same can be said for sessions/instructors/students etc.

Yes, the original issue is an epic targeted at all those permissions as well. This PR is "part of", tacking only the portion for courses.

Note that this is not a backwards compatible change.

I suspected as much, thanks for confirming. @daongochieu2810 if you'd rather not have to account for legacy data, we can put this PR on hold until other portions of the epic are resolved. Following which we'll need a data migration script. Alternatively I could set up a feature branch actually.

Regardless, you should be able to claim this PR for 3281 credit since it's already approved. Let me know whether you're able to account for legacy permissions in this PR, and I'll think about where to go from there.

@madanalogy madanalogy added the s.OnHold The issue/PR's validity has been put on hold pending some other event label Mar 14, 2021
@daongochieu2810
Copy link
Contributor Author

I think having a script to migrate legacy data is better since we dont need to have both CAN_MODIFY_COURSE and fine-grained permissions in the db. I can work on this script and update the PR accordingly

@daongochieu2810
Copy link
Contributor Author

@madanalogy I dont think we should delay this until other portions of the PR are done, as there will be a lot of merge conflicts. It is probably better if we maintain a script to migrate legacy data and update it as other portions of the PR are added

@madanalogy
Copy link
Contributor

Merge conflicts are the least of our concerns. Data migration needs to be done in phases. You need new features to be compatible with old data until such a time as a data migration script can be run. Even if you have the script ready, you cannot be certain that it will 100% work the first time you run it on production. This PR will be left on hold until such a time as other aspects are tackled and/or the changes are engineered to be backwards compatible.

@daongochieu2810
Copy link
Contributor Author

oh I see, then we should leave this on hold for now

@wkurniawan07 wkurniawan07 removed their request for review July 10, 2021 15:17
@rrtheonlyone rrtheonlyone removed the s.FinalReview The PR is ready for final review label Aug 21, 2021
@madanalogy
Copy link
Contributor

Closing for now until issue validity is discussed

@madanalogy madanalogy closed this Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s.OnHold The issue/PR's validity has been put on hold pending some other event
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants