Skip to content

Adding permission checks to subsection and unit sidebar settings - #3250

Open
jacobo-dominguez-wgu wants to merge 1 commit into
openedx:masterfrom
WGU-Open-edX:sidebar-settings-permissions
Open

jacobo-dominguez-wgu wants to merge 1 commit into
openedx:masterfrom
WGU-Open-edX:sidebar-settings-permissions

Conversation

@jacobo-dominguez-wgu

@jacobo-dominguez-wgu jacobo-dominguez-wgu commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Description

This PR extends the canEditCourseContent permission gating to the section, subsection, and unit sidebar settings on the course outline page, so that users who can view a course but cannot edit its content see these settings in a read-only state instead of being able to change them.

Added unit tests to support modifications and created new unit tests files to increase code coverage.

User roles impacted

  • Course Auditor — will now see section, subsection, and unit sidebar settings in a disabled/read-only state when they lack edit permission.
  • Users with full edit permission see no change in behavior.

Supporting information

Addresses comment #3200 (comment)
Coses openedx/openedx-authz#383.
Figma: link

Testing instructions

  1. Open a course as a user with canEditCourseContent (any but Course Auditor) . Open the course outline, select a section, subsection, and unit in the sidebar, and confirm all settings (highlights edit, release date, grading, visibility, special exams, prerequisites) are editable as before.
  2. Open the same course as a user without canEditCourseContent (Course Auditor). Confirm:
    • The Highlights edit button is hidden, but existing highlights are still shown.
    • Release date/time pickers are read-only.
    • Grading toggle, grader dropdown, due date/time, assessment-results toggles, and special-exam options are disabled.
    • Prerequisite dropdown, min-score / min-completion inputs, and the prerequisite checkbox are disabled.

Other information

View on section sidebar settings without canEditCourseContent permission
image

View on subsection sidebar settings without canEditCourseContent permission
image

View on unit sidebar without settings canEditCourseContent permission
image

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 Sep 15, 2026
@openedx-webhooks

openedx-webhooks commented Sep 15, 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 Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.03%. Comparing base (87cba01) to head (3bb0615).

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #3250    +/-   ##
========================================
  Coverage   96.03%   96.03%            
========================================
  Files        1407     1407            
  Lines       34287    34302    +15     
  Branches     7882     8157   +275     
========================================
+ Hits        32928    32943    +15     
  Misses       1318     1318            
  Partials       41       41            

☔ 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 force-pushed the sidebar-settings-permissions branch from 6124545 to 51fc801 Compare September 15, 2026 19:36
@jacobo-dominguez-wgu
jacobo-dominguez-wgu marked this pull request as ready for review September 15, 2026 19:54
@jacobo-dominguez-wgu jacobo-dominguez-wgu moved this from Needs Triage to Ready for Review in Contributions Sep 15, 2026
@BryanttV BryanttV linked an issue Sep 15, 2026 that may be closed by this pull request

@BryanttV BryanttV 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.

Hi @jacobo-dominguez-wgu, thanks for handling this! I was testing it and everything works great for subsections and units. However, if I select a course section without Highlights, the 'Add Highlights' button remains enabled for Course Auditors

Can we fix this?

@jacobo-dominguez-wgu
jacobo-dominguez-wgu force-pushed the sidebar-settings-permissions branch from 51fc801 to 3bb0615 Compare September 15, 2026 22:13
@jacobo-dominguez-wgu

Copy link
Copy Markdown
Contributor Author

Hi @jacobo-dominguez-wgu, thanks for handling this! I was testing it and everything works great for subsections and units. However, if I select a course section without Highlights, the 'Add Highlights' button remains enabled for Course Auditors

Can we fix this?

Fixed! Thanks for catching this!

@BryanttV BryanttV 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.

LGTM!

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). open-source-contribution PR author is not from Axim or 2U

Projects

Status: Ready for Review

Development

Successfully merging this pull request may close these issues.

Task - Implement Course Access & Content

4 participants