feat: implement schedule and details permissions#2991
feat: implement schedule and details permissions#2991bra-i-am wants to merge 5 commits intoopenedx:masterfrom
Conversation
|
Thanks for the pull request, @bra-i-am! 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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2991 +/- ##
========================================
Coverage 95.52% 95.53%
========================================
Files 1392 1392
Lines 32911 32939 +28
Branches 7340 7601 +261
========================================
+ Hits 31437 31467 +30
+ Misses 1419 1404 -15
- Partials 55 68 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
83be311 to
23adfbf
Compare
23adfbf to
3807a87
Compare
a2cfe29 to
65ff3ff
Compare
Description
Implements fine-grained authorization for the Schedule & Details page using the existing
authzmodule. Three new permission constants are introduced:courses.view_schedule_and_details— gates access to the entire pagecourses.edit_schedule— controls whether date fields (start/end/enrollment dates) are editablecourses.edit_details— controls whether all other fields (pacing, language, description, images, instructors, license, etc.) are editableHow it behaves:
view_schedule_and_details, aPermissionDeniedAlertis rendered instead of the page.edit_schedule, all date inputs in the Schedule section are rendered as read-only.edit_details, all remaining inputs (pacing radios, language dropdown, WYSIWYG editors, image uploads, instructor fields, learning outcomes, license selector, requirements) are disabled.Impacted roles: Course Authors and Operators. Learners are unaffected.
Two generic components were extended to support a
disabledprop:WysiwygEditorandCourseUploadImage.Supporting information
src/authz/).useCourseUserPermissions.Testing instructions
enable_authz_course_authoringwaffle flag for your test user/course.courses.view_schedule_and_detailsfrom the user's permissions → the page should show the permission denied alert instead of the form.courses.edit_schedule→ all date inputs (Start Date, End Date, Enrollment Start, Enrollment End) should be read-only; details fields remain editable.courses.edit_details→ pacing radios, language dropdown, description fields, image uploads, instructor fields, learning outcomes, license buttons, and requirements fields should all be disabled; date fields remain editable.enable_authz_course_authoring→ page should render and behave exactly as before (no regression).Other information
upgradeDeadlinefield remains always read-only regardless of permissions (it is platform-managed and not user-editable).WysiwygEditorandCourseUploadImageare generic components — the newdisabledprop is backward-compatible with afalsedefault.Best Practices Checklist
.ts,.tsx).propTypesanddefaultPropsin any new or modified code.src/testUtils.tsx(specificallyinitializeMocks)apiHooks.tsin this repo for examples.messages.tsfiles have adescriptionfor translators to use.../in import paths. To import from parent folders, use@src, e.g.import { initializeMocks } from '@src/testUtils';instead offrom '../../../../testUtils'