feat(authz): add read only permissions alert - #3193
Conversation
|
Thanks for the pull request, @dcoa! 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 #3193 +/- ##
=======================================
Coverage 95.88% 95.89%
=======================================
Files 1397 1397
Lines 33554 33583 +29
Branches 7893 7913 +20
=======================================
+ Hits 32172 32203 +31
+ Misses 1323 1321 -2
Partials 59 59 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
db1148d to
bf3502f
Compare
f652937 to
8051d8f
Compare
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
8051d8f to
1637fae
Compare
I'm trying to test this PR. Can you please give a detailed example of how to do that? BTW I also encountered a bug with the API docs and had to fix it before I could access that page. Why can't I use http://apps.local.openedx.io:2025/admin-console/authz/assign-role to assign "Course Auditor"? It shows the role there, but it's disabled. |
|
@bradenmacdonald Sorry for the inconvenience with the test instructions, in terms of how to assign a role, you can use the follow as an example of body request ( you can also access the API endpoint directly using http://local.openedx.io:8000/api/authz/v1/roles/users/) : {
"role": "course_auditor", // other supported roles are course_editor, course_staff, course_admin
"scope": "course-v1:testing+CT01+CT01-2024", // course_id
"users": [
"dcoa" // username or email, comma-separated
]
}Then you should receive a 200 response with a message confirming that the assignment was successful.
The roles were not enabled in the Admin Console because they were not yet available/fully supported in Verawood release. The decision was to first implement them in the Authoring UI and ensure that permission validation was working correctly. Once that validation was guaranteed, the roles could be safely enabled in the Admin Console. (as is visible in the issue logs openedx/openedx-authz#285) If you like to use the UI I just have a draft PR for it, the change is very simple openedx/frontend-app-admin-console#209 |
Description
This PR is the continuation of the effort to implement the new Authz system into Course Authoring. The PR is focused on displaying a View Only Alert for Course Auditors/Course Editors.
Implemented changes
ViewOnlyPermissionsAlert(src/generic/ViewOnlyPermissionsAlert.tsx) with the option to override the default message viachildren.Alertwith a section-scoped message. The two alerts never stack: the section-scoped alert shows only when the user can edit details but not schedule; when they can edit neither, the page-level alert stands in for it.SubHeadercomponent. In this way we are able to locate the Alert right behind the main title in Grading (and in a future PR in Advanced Settings).Supporting information
Testing instructions
authz.enable_course_authoringwaffle flag.course_auditorto a user by the API<lms_url>/api-docs/#/authz/authz_v1_roles_users_updatecourse_editorto a user by the API<lms_url>/api-docs/#/authz/authz_v1_roles_users_updateGrading Page
Schedule and Details
Course Auditor
Course Editor
Course Updates
Best Practices Checklist
We're trying to move away from some deprecated patterns in this codebase. Please
check if your PR meets these recommendations before asking for a review:
.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'