Skip to content

feat: enforce openedx-authz permissions on object tag and xblock outline endpoints#38292

Open
wgu-taylor-payne wants to merge 2 commits intoopenedx:masterfrom
WGU-Open-edX:tpayne/authz-for-taxonomies
Open

feat: enforce openedx-authz permissions on object tag and xblock outline endpoints#38292
wgu-taylor-payne wants to merge 2 commits intoopenedx:masterfrom
WGU-Open-edX:tpayne/authz-for-taxonomies

Conversation

@wgu-taylor-payne
Copy link
Copy Markdown
Contributor

@wgu-taylor-payne wgu-taylor-payne commented Apr 7, 2026

Description

When AUTHZ_COURSE_AUTHORING_FLAG is enabled for a course, enforces openedx-authz permissions on content tagging and xblock outline endpoints, fully bypassing legacy permission checks.

Object tag endpoints (/api/content_tagging/v1/object_tags/{object_id}/):

  • PUT — enforces courses.manage_tags via authz_api.is_user_allowed. Legacy ObjectTagObjectPermissions, view_objecttag in get_queryset, and per-taxonomy can_tag_object checks inside the parent's update() are all bypassed when authz is active.
  • GET — patches can_tag_object in the response based on the authz manage_tags check, so the frontend content tags drawer correctly shows/hides editing controls without any frontend changes.

Course key is extracted from any content key type (course, block, unit, collection, container) via get_context_key_from_key_string. Library content is unaffected — falls through to legacy checks.

Xblock outline endpoint (/xblock/outline/{usage_key}):

  • GET — replaces has_studio_read_access with user_has_course_permission using courses.view_course, with legacy READ fallback when the flag is off. This endpoint is not directly associated with managing tags, but in Studio when the content tags drawer opens (e.g. in the course outline, course unit editor, etc.) the xblock outline endpoint is called.

When the flag is off, all endpoints use existing legacy behavior unchanged.

Endpoint → permission mapping:

Endpoint Permission Flag scope
PUT /object_tags/{object_id}/ courses.manage_tags per-course
GET /object_tags/{object_id}/ can_tag_object patched per-course
GET /xblock/outline/{usage_key} courses.view_course per-course

Roles and permissions (from Casbin policy):

Role view_course manage_tags
course_admin
course_staff
course_editor
course_auditor

Note on legacy permission coexistence: The parent ObjectTagView (from openedx-tagging) enforces legacy permissions at two levels: the ObjectTagObjectPermissions permission class runs at DRF dispatch, and per-taxonomy oel_tagging.can_tag_object checks run inside the parent's update method. When authz is active, all of these are bypassed via get_permissions(), get_queryset(), and _update_tags() overrides.

Supporting information

Testing instructions

Flag OFF (legacy behavior unchanged):

  1. Ensure authz.enable_course_authoring waffle flag is inactive
  2. As a course staff user, verify tagging content objects works as before
  3. Verify xblock outline endpoint returns 200

Flag ON per-course:

  1. Django Admin → Waffle Flag Course Overrides → authz.enable_course_authoring for a specific course → Force On
  2. As course_staff: open course outline → click tag icon on a section → add/remove tags → save. Should succeed.
  3. As course_auditor: open course outline → click tag icon. Drawer should open read-only (no "Add tags" button).
  4. As course_auditor: verify xblock outline endpoint still loads (has view_course).
  5. As a user with no authz role: verify both endpoints return 403.
  6. For a different course without the override: should fall through to legacy checks.

Deadline

Verawood

Other information

Co-authored with Kiro — AI-assisted implementation and testing.

@wgu-taylor-payne wgu-taylor-payne self-assigned this Apr 7, 2026
@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 Apr 7, 2026
@openedx-webhooks
Copy link
Copy Markdown

openedx-webhooks commented Apr 7, 2026

Thanks for the pull request, @wgu-taylor-payne!

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

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.

@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Apr 7, 2026
@wgu-taylor-payne wgu-taylor-payne marked this pull request as draft April 7, 2026 01:42
@wgu-taylor-payne wgu-taylor-payne force-pushed the tpayne/authz-for-taxonomies branch 2 times, most recently from d1ae95c to c26f972 Compare April 7, 2026 16:30
@mphilbrick211 mphilbrick211 added the mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). label Apr 8, 2026
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Apr 8, 2026
@rodmgwgu
Copy link
Copy Markdown
Contributor

rodmgwgu commented Apr 9, 2026

@wgu-taylor-payne we discussed this in the Weekly meeting and the decision is that for M1 we will only focus on implementing the courses.manage_tags permission on course-related endpoints.

So no taxonomies-related changes for now.

@wgu-taylor-payne wgu-taylor-payne force-pushed the tpayne/authz-for-taxonomies branch 5 times, most recently from 55ae268 to 51f9f3e Compare April 13, 2026 17:22
@wgu-taylor-payne wgu-taylor-payne changed the title feat: authorize tags and taxonomies endpoints via openedx-authz when … feat: authorize object tag updates via openedx-authz when flag is enabled Apr 13, 2026
@wgu-taylor-payne wgu-taylor-payne force-pushed the tpayne/authz-for-taxonomies branch 2 times, most recently from 3465a67 to 2be413a Compare April 13, 2026 21:46
…ine endpoints

When AUTHZ_COURSE_AUTHORING_FLAG is enabled for a course, legacy
permission checks are fully bypassed in favor of openedx-authz:

- PUT /object_tags/{object_id}/: enforces courses.manage_tags
- GET /object_tags/{object_id}/: patches can_tag_object in response
- GET /xblock/outline/{usage_key}: enforces courses.view_course

For object tag endpoints, the parent ObjectTagView legacy checks
(ObjectTagObjectPermissions, per-taxonomy can_tag_object, and
view_objecttag in get_queryset) are all bypassed via get_permissions,
get_queryset, and _update_tags overrides. Course key is extracted from
any content key type via get_context_key_from_key_string. Library
content is unaffected (falls through to legacy).

When the flag is off, all endpoints use existing legacy behavior.

Co-authored-by: Kiro <kiro-noreply@amazon.com>
@wgu-taylor-payne wgu-taylor-payne force-pushed the tpayne/authz-for-taxonomies branch from 2be413a to 97a2719 Compare April 13, 2026 22:10
@wgu-taylor-payne wgu-taylor-payne changed the title feat: authorize object tag updates via openedx-authz when flag is enabled feat: enforce openedx-authz permissions on object tag and xblock outline endpoints Apr 13, 2026
@wgu-taylor-payne wgu-taylor-payne marked this pull request as ready for review April 13, 2026 22:51
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: Waiting on Author

Development

Successfully merging this pull request may close these issues.

Task - RBAC Authz - Implement new permissions for Tags and Taxonomies

4 participants