Adding permission checks on course outline page for course content edition part 1 - #3196
Adding permission checks on course outline page for course content edition part 1#3196jacobo-dominguez-wgu wants to merge 3 commits into
Conversation
|
Thanks for the pull request, @jacobo-dominguez-wgu! 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. |
37ef93f to
b19b99b
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3196 +/- ##
==========================================
+ Coverage 95.88% 95.92% +0.03%
==========================================
Files 1397 1397
Lines 33554 33581 +27
Branches 7893 7666 -227
==========================================
+ Hits 32172 32211 +39
- Misses 1323 1327 +4
+ Partials 59 43 -16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
I need a little more info on what to put for each field there. The API docs do not give any examples :/
(I also had to fix this bug to be able to access the api-docs at all.) |
|
Can we improve the test description, please? There is not clear difference between the Course Auditor and the Course Editor permissions. In both cases the description say the red squared sections should be hidden, however a Course Editor can access the unit dropdown menu or the add button at the top. |
c408508 to
d046730
Compare
|
I have addressed your comments and updated the pr description and testing instructions. @dcoa, @bradenmacdonald Could you take another look? |
5e0e422 to
e8a3ff0
Compare
| data-testid={`${namePrefix}-card-header__menu-delete-button`} | ||
| onClick={onClickDelete} | ||
| > | ||
| <FormattedMessage {...messages.menuDelete} /> |
There was a problem hiding this comment.
this should be
{intl.formatMessage(messages.menuDelete)}
There was a problem hiding this comment.
It's not a big deal at all, but if you happen to notice any of these and feel like updating them while you're working on this stuff, please do. (Declarative preferred over imperative.)
Using declarative way now #3196 (comment)

Description
Conditionally renders or hides the editable and publishable course content sections on the course outline home page.
The goal is to ensure that users with these roles interact only with the permitted elements, by applying “read-only” states or disabling modification actions as defined by the design.
This first pr focus on the course outline page, there will be future prs for section/unit specific internal page.
Permission Matrix
courses.view_coursecourses.create_coursecourses.publish_course_contentcourses.edit_course_contentThe elements covered on this pr are the ones highlighted by the red squares.

Supporting information
Partially closes openedx/openedx-authz#383
Figma
Testing instructions
Requirements
Enable the
authz.enable_course_authoringwaffle flag.You can set course_auditor or course_editor role to a user using the API
<lms_url>/api-docs/#/authz/authz_v1_roles_users_updatePayload example:
Test case 1
Log in with a user with course_auditor role.

Go to studio home page and select the course on which the user is course_auditor to get into the course outline page.
Make sure you are allowed to see the course content info but not allowed to add/update course content nor publish the course.
The sections highlighted on red must not be visible for course audit role:
NOTE: The permission related to Tags are handled on a different ticket openedx/openedx-authz#314
Test case 2
Log in with a user with course_editor role.

Go to studio home page and select the course on which the user is course_editor to get into the course outline page.
Make sure you are allowed to see the course content info, add/update course content but not allowed publish the course.
Publish buttons/items must not be visible:
Test case 3
Log in with a user with role different than course_editor or course_auditor, (can be staff, superuser, course_admin or course_staff).
Go to studio home page and select the course on which the user has the prev permission set to go into the course outline page.
Make sure all the sections related to add, update and publish course content are visible and remain functional.
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'