Skip to content

feat: add new content library enforcement points#38071

Open
BryanttV wants to merge 5 commits intoopenedx:masterfrom
eduNEXT:bav/add-missing-library-enforcement-points
Open

feat: add new content library enforcement points#38071
BryanttV wants to merge 5 commits intoopenedx:masterfrom
eduNEXT:bav/add-missing-library-enforcement-points

Conversation

@BryanttV
Copy link
Contributor

@BryanttV BryanttV commented Mar 2, 2026

Description

This PR adds missing authorization enforcement points for Content Libraries v2, aligning tagging and reuse operations with the new granular authz permissions (notably MANAGE_LIBRARY_TAGS and REUSE_LIBRARY_CONTENT). Currently, some operations on Content Libraries v2 rely on generic edit/view permissions instead of the more specific g2 authz permissions

What This PR Changes

  • New helper for library tagging access

    • Adds has_library_tagging_access(user, library_key). This helper looks up the ContentLibrary object and checks MANAGE_LIBRARY_TAGS via user_has_permission_across_lib_authz_systems.
  • Updated tagging rules for library content

    • Updates can_change_object_tag_objectid. If the context is a LibraryLocatorV2, it now uses has_library_tagging_access and therefore requires MANAGE_LIBRARY_TAGS. For other contexts (courses, XBlocks, etc.), it still falls back to has_studio_write_access as before.
  • New enforcement for content reuse flows

    • The LibraryPasteClipboardView now requires authz_permissions.REUSE_LIBRARY_CONTENT instead of the legacy CAN_EDIT_THIS_CONTENT_LIBRARY permission.
    • The ClipboardEndpoint now also requires REUSE_LIBRARY_CONTENT (rather than CAN_VIEW_THIS_CONTENT_LIBRARY) when bringing content from a library into a course.
  • Authz-to-legacy permission mapping updates

    • In _transform_authz_permission_to_legacy_lib_permission is extended so that:
      • MANAGE_LIBRARY_TAGSCAN_EDIT_THIS_CONTENT_LIBRARY
      • REUSE_LIBRARY_CONTENTCAN_VIEW_THIS_CONTENT_LIBRARY
    • This keeps the legacy permission layer in sync with the new authz permissions.

Supporting information

Testing instructions

You can test the following endpoints:

REUSE_LIBRARY_CONTENT

All library roles (Library Admin, Library Author, Library Contributor, and Library User) can reuse library content:

  • POST {studio_domain}/api/content-staging/v1/clipboard/: Copy content to the clipboard.
  • POST {studio_domain}/api/libraries/v2/{library_key}/paste_clipboard/: Paste content from the clipboard into a library.

MANAGE_LIBRARY_TAGS

All library roles (except Library User) can manage (add or remove) tags for content in a library:

  • PUT {studio_domain}/api/content_tagging/v1/object_tags/{object_key}/: Add or remove tags from library content.

You can use the following Postman Collection.

Deadline

None

@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 Mar 2, 2026
@openedx-webhooks
Copy link

openedx-webhooks commented Mar 2, 2026

Thanks for the pull request, @BryanttV!

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 Mar 2, 2026
@BryanttV BryanttV force-pushed the bav/add-missing-library-enforcement-points branch from 3c811b1 to 20ab0d2 Compare March 3, 2026 01:17
@BryanttV BryanttV changed the title feta: add new content library enforcement points feat: add new content library enforcement points Mar 3, 2026
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Mar 3, 2026
@BryanttV BryanttV force-pushed the bav/add-missing-library-enforcement-points branch 5 times, most recently from d976851 to a12343b Compare March 5, 2026 14:53
@BryanttV BryanttV marked this pull request as ready for review March 5, 2026 19:01
@BryanttV BryanttV force-pushed the bav/add-missing-library-enforcement-points branch from a12343b to d9f2892 Compare March 6, 2026 16:57
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: Waiting on Author

Development

Successfully merging this pull request may close these issues.

Add enforcement points for manage_library_tags and reuse_library_content

2 participants