Skip to content

Adding permission checks on course outline page for course content edition part 1 - #3196

Open
jacobo-dominguez-wgu wants to merge 3 commits into
openedx:masterfrom
WGU-Open-edX:feat/course-access-content
Open

Adding permission checks on course outline page for course content edition part 1#3196
jacobo-dominguez-wgu wants to merge 3 commits into
openedx:masterfrom
WGU-Open-edX:feat/course-access-content

Conversation

@jacobo-dominguez-wgu

@jacobo-dominguez-wgu jacobo-dominguez-wgu commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

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

Category Permission Course Editor Course Auditor
Course Access & Content courses.view_course
courses.create_course
courses.publish_course_content
courses.edit_course_content

The elements covered on this pr are the ones highlighted by the red squares.
image

Supporting information

Partially closes openedx/openedx-authz#383
Figma

Testing instructions

Requirements

Enable the authz.enable_course_authoring waffle 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_update
Payload example:

{
  "role": "course_auditor", // role
  "scope": "course-v1:OpenedX+DemoX+DemoCourse", //courseId
  // use scopes instead of scope if you need to set more than 1 resource
  "users": [
    "my_username" // username or email
  ]
}
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:
image
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:
image

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:

  • Any new files are using TypeScript (.ts, .tsx).
  • Avoid propTypes and defaultProps in any new or modified code.
  • Tests should use the helpers in src/testUtils.tsx (specifically initializeMocks)
  • Do not add new fields to the Redux state/store. Use React Context to share state among multiple components.
  • Use React Query to load data from REST APIs. See any apiHooks.ts in this repo for examples.
  • All new i18n messages in messages.ts files have a description for translators to use.
  • Avoid using ../ in import paths. To import from parent folders, use @src, e.g. import { initializeMocks } from '@src/testUtils'; instead of from '../../../../testUtils'

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Aug 13, 2026
@openedx-webhooks

openedx-webhooks commented Aug 13, 2026

Copy link
Copy Markdown

Thanks for the pull request, @jacobo-dominguez-wgu!

This repository is currently maintained by @bradenmacdonald.

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 approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To 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:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where 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:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.92%. Comparing base (67cee5c) to head (d80c590).
⚠️ Report is 5 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jacobo-dominguez-wgu jacobo-dominguez-wgu changed the title feat: adding permission checks on course outline page for course cont… Adding permission checks on course outline page for course content edition Aug 13, 2026
@jacobo-dominguez-wgu jacobo-dominguez-wgu added the mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). label Aug 13, 2026
@jacobo-dominguez-wgu
jacobo-dominguez-wgu marked this pull request as ready for review August 13, 2026 20:33
@jacobo-dominguez-wgu jacobo-dominguez-wgu changed the title Adding permission checks on course outline page for course content edition Adding permission checks on course outline page for course content edition part 1 Aug 14, 2026
@bradenmacdonald

Copy link
Copy Markdown
Contributor

You can set course_auditor or course_editor role to a user using the API <lms_url>/api-docs/#/authz/authz_v1_roles_users_update

I need a little more info on what to put for each field there. The API docs do not give any examples :/

Screenshot 2026-08-14 at 4 07 20 PM

(I also had to fix this bug to be able to access the api-docs at all.)

Comment thread src/course-outline/card-header/CardHeader.tsx Outdated
Comment thread src/course-outline/card-header/CardHeader.tsx Outdated
Comment thread src/course-outline/status-bar/StatusBar.tsx Outdated
Comment thread src/course-outline/CourseOutlineContext.tsx Outdated
Comment thread src/course-outline/outline-sidebar/info-sidebar/CourseInfoSidebar.tsx Outdated
@dcoa

dcoa commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

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.

Comment thread src/course-outline/card-header/CardHeader.tsx Outdated
@jacobo-dominguez-wgu
jacobo-dominguez-wgu force-pushed the feat/course-access-content branch 2 times, most recently from c408508 to d046730 Compare August 17, 2026 18:52
@jacobo-dominguez-wgu

Copy link
Copy Markdown
Contributor Author

I have addressed your comments and updated the pr description and testing instructions. @dcoa, @bradenmacdonald Could you take another look?

@dcoa dcoa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It works as expected, just a small catch

Comment thread src/course-outline/OutlineTree.tsx Outdated
@jacobo-dominguez-wgu
jacobo-dominguez-wgu force-pushed the feat/course-access-content branch from 5e0e422 to e8a3ff0 Compare August 19, 2026 17:42
Comment thread src/course-outline/OutlineNode.tsx Outdated
data-testid={`${namePrefix}-card-header__menu-delete-button`}
onClick={onClickDelete}
>
<FormattedMessage {...messages.menuDelete} />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this should be
{intl.formatMessage(messages.menuDelete)}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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)

@mphilbrick211 mphilbrick211 moved this from Needs Triage to In Eng Review in Contributions Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). open-source-contribution PR author is not from Axim or 2U

Projects

Status: In Eng Review

Development

Successfully merging this pull request may close these issues.

Task - Implement Course Access & Content

6 participants