Skip to content

Gate XBlock component card action menu on RBAC edit_course_content permission - #39013

Draft
jacobo-dominguez-wgu wants to merge 1 commit into
openedx:masterfrom
WGU-Open-edX:xblock-edit-permission
Draft

Gate XBlock component card action menu on RBAC edit_course_content permission#39013
jacobo-dominguez-wgu wants to merge 1 commit into
openedx:masterfrom
WGU-Open-edX:xblock-edit-permission

Conversation

@jacobo-dominguez-wgu

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

Copy link
Copy Markdown

Description

This PR gates the XBlock component card action menu (header-actions div) in the Studio course-unit page on the RBAC courses.edit_course_content permission, but only when the authz.enable_course_authoring waffle flag is on for the course.

Two new boolean flags, is_authz_authoring_enabled and authz_can_edit_course_content, are computed once per preview request in xblock_view_handler and threaded through _studio_wrap_xblock to the studio_xblock_wrapper.html template. The template wraps the entire header-actions div with:

% if not is_authz_authoring_enabled or authz_can_edit_course_content:

This means:

  • Flag off (default for most courses today): is_authz_authoring_enabled=False, condition is always True, the menu renders exactly as before — zero behaviour change.
  • Flag on + user allowed: both flags True, menu renders normally.
  • Flag on + user denied: authz_can_edit_course_content=False, menu is suppressed.

Affected roles:
Course Authors / Course Staff in courses where the authz flag is enabled. Roles with courses.edit_course_content (COURSE_EDITOR, COURSE_STAFF, COURSE_ADMIN) continue to see the full menu. Roles without it (COURSE_AUDITOR, etc.) no longer see the menu.

No database migrations. No new feature flags — reuses the existing
authz.enable_course_authoring waffle flag.

Supporting information

Continuation of openedx/frontend-app-authoring#3196 (course outline home page) and openedx/frontend-app-authoring#3200 (course subsections/units page).
Partially closes openedx/openedx-authz#383
Depends on openedx/openedx-authz#384.
Figma design

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
  ]
}
  1. Log in as a user with COURSE_AUDITOR role (no edit_course_content).
  2. Navigate to the Studio course-unit page.
  3. Verify the component card action menu (pencil + kebab) is not rendered.
  4. Log in as a user with COURSE_EDITOR or COURSE_STAFF.
  5. Verify the menu is visible and functional as before.
  6. Disable the authz.enable_course_authoring flag for the course and repeat
    step 1 — the menu must be visible (flag-off fallback).

Other information

View for COURSE_EDITOR, COURSE_STAFF, COURSE_ADMIN, superuser with authz.enable_course_authoring waffle flag on:
image

View for COURSE_AUDITOR with authz.enable_course_authoring waffle flag on:
image

AI usage notice

Used Claude Opus 4.8 through kiro to assist on the modification and creation of unit tests.

Warning

Needs this pr merged to be fully functional, will be in draft status until the 403 problem is fixed openedx/openedx-authz#384

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

Copy link
Copy Markdown

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

This repository is currently maintained by @openedx/wg-maintenance-openedx-platform-oncall.

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.

🔘 Update the status of your PR

Your PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate.


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.

@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Aug 21, 2026
@jacobo-dominguez-wgu jacobo-dominguez-wgu changed the title feat: adding authz edit permission check on xblock wrapper Gate XBlock component card action menu on RBAC edit_course_content permission Aug 21, 2026
@jacobo-dominguez-wgu
jacobo-dominguez-wgu force-pushed the xblock-edit-permission branch 2 times, most recently from e2806ad to b05b1f4 Compare August 21, 2026 18:55
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: Needs Triage

Development

Successfully merging this pull request may close these issues.

Course Auditor receives 403 error when navigating to course units Task - Implement Course Access & Content

2 participants