Skip to content

Task - implement library updates #319

Open
openedx/frontend-app-authoring
#3202

Description

@MaferMazu

Description

This task covers the views and components related to Library Updates in the Authoring MFE. Users must only be able to use the actions allowed by both of these:

  1. Their course permissions: Course Auditors get a read-only experience, and Course Editors get management actions.
  2. Their access to the source library: as defined in the Library updates in Authoring product proposal, previewing, accepting, or ignoring an update also requires permission to view the source library.

Design: Figma

Current Behavior

  • The Library Updates views do not offer a read-only experience for users who can view library updates but cannot manage them.
  • They do not consider whether the user can view the source library of each update. The backend will reject preview, accept, and ignore requests from users without that access.

Expected Behavior

Course permissions

Permission Course Editor Course Auditor
courses.view_library_updates ✅ ✅
courses.manage_library_updates ✅ ❌

Resulting behavior per update

Can view source library Can manage updates Preview Accept / Ignore
✅ ✅ Available Enabled
✅ ❌ Available Visible but disabled, with a tooltip
❌ ✅ or ❌ Replaced by a permission notice See the table below

Without access to the source library

Surface Behavior
Course outline Keep the update notification, remove the Review button, and explain why the content remains unchanged.
Unit sidebar Replace Review Updates with an explanation of the restriction.
Library Updates page Keep the affected items visible, and replace the Review, Update (accept), and Ignore actions with a permission notice.
Preview modal Replace the new version preview with a permission notice, and disable Accept changes and Ignore changes.

Acceptance Criteria

Page access and navigation

  • A user with courses.view_library_updates can open the Libraries page and the Review Content Updates tab.
  • The Libraries link in the course header menu is shown to users with courses.view_library_updates.
  • A user without courses.view_library_updates sees the existing PermissionDeniedAlert.

Read-only users with library access

  • On each update card, Review Updates is enabled, and Update and Ignore are visible but disabled. They are not hidden.
  • In the preview modal, Accept changes and Ignore changes are disabled, as are the variants for locally modified content (Update to published library content and Keep course content).
  • Hovering over a disabled action shows: Your role doesn't include permission to do this. Contact your org admin to request access
  • The out-of-sync alert does not promise accept or ignore actions. It says "Review updates to see what changed".

Library access

  • Access to each source library is read from the can_view_upstream_library field of the downstreams summary (GET /api/contentstore/v2/downstreams/{course_key}/summary), and matched to each update by its library key. The frontend does not check library permissions on its own.
  • The check applies to every user, including those who have courses.manage_library_updates.
  • While permissions and library access are loading, the UI does not briefly show actions or messages that then change.
  • The UI does not request library preview content for a library the user cannot view.

Course outline without library access

  • The update notification is still shown, without the Review button, with the message from the design. For one component: "1 library component is out of sync. Current content will remain unchanged until a member with review permissions accepts updates." The message handles plural counts.
  • If pending updates come from several libraries and the user can view at least one of them, the notification keeps the Review button. The restriction is shown only on the blocked items.

Unit sidebar without library access

  • The Review Updates action in the library reference card is replaced by the restriction explanation from the design.

Library Updates page without library access

  • Affected items remain visible, and their Review Updates, Update, and Ignore actions are replaced by: "You do not have permission to review updates for this library. The course content will remain on its current version until a member with review permissions accepts the changes."
  • Items from libraries the user can view keep the behavior that matches their course permissions.

Preview modal without library access

  • The new version preview is replaced by the same permission notice.
  • Accept changes and Ignore changes (and their variants for locally modified content) are disabled, with the tooltip shown in the design.
  • This applies from every place that opens the modal, including the component sync action on the unit page.

Quality

  • Tests cover all combinations of library access and course permissions on each surface, including a mix of accessible and restricted libraries.
  • All new messages are translatable and include a description for translators.

Out of Scope

  • Changes to the legacy Studio unit page.
  • Backend enforcement, tracked separately.

Dependencies

Technical Notes

  • Component preview: the Old version tab can stay as it is. The preview modal passes the course block key as oldUsageKey, so that tab renders course content and does not depend on library access. Only the New version content needs the permission notice.
  • Container preview: CompareContainersWidget shows Before (course data) and After (library data) side by side. A failed library request currently replaces the whole comparison with an error, and the Before list is only built once both responses are available. Without library access, Before should still show the course content, and the permission notice should replace After, without requesting library data.
  • Several libraries can have pending updates in one course. The downstreams summary returns one item per source library, so one request covers all of them. Verify that every affected surface can use it.

Activity

  1. moved this to In Grooming in RBAC AuthZ Boardon Aug 4, 2026
  2. BryanttV commented on Aug 10, 2026

    @BryanttV
    Contributor

    Hi @dcoa, could you help me refine this issue? It seems to me that we'll also need to add a new read-only permission here.

    cc @gviedma-aulasneo

  3. dcoa commented on Aug 11, 2026

    @dcoa
    Contributor

    Yes, we should add a view permission to distinguish unauthorized users from Course Auditors.

    Refinement

    Acceptance criteria

    1. A user with courses.view_library_updates (but without courses.manage_library_updates)
      can open the Libraries page and the "Review Content Updates" tab.
    2. On each update card, the Update (accept) and Ignore buttons are
      disabled.
    3. The preview modal's Accept changes / Ignore changes buttons (and the
      locally-modified variants "Update to published library content" / "Keep course
      content") are disabled for read-only users.
    4. Hovering any disabled button shows the tooltip:
      Your role doesn't include permission to do this. Contact your org admin to request access
    5. "Review Updates" (open preview) remains enabled for read-only users — viewing
      is allowed.
    6. A user without courses.view_library_updates still gets the existing
      PermissionDeniedAlert.
    7. The course header "Libraries" menu link is shown to users with the view
      permission (so view-only users can actually reach the page).

    Implementation tasks (frontend-app-authoring)

    1. Authz plumbing

    • src/authz/constants.ts: add VIEW_LIBRARY_UPDATES: 'courses.view_library_updates'.
    • src/authz/permissionHelpers.ts: add canViewLibraryUpdates to
      getLibraryUpdatesPermissions() (view + manage, both course-scoped).
    • src/authz/permissionHelpers.test.ts: update the assertion for the new shape.

    2. Read-only message

    • src/generic/messages.ts: add readOnlyTooltip with the exact copy above
      (description included for translators). Shared so both the review tab and the
      preview modal use the same string.

    3. Page gating + read-only propagation

    • src/course-libraries/CourseLibraries.tsx:
      • gate on canViewLibraryUpdates (PermissionDeniedAlert otherwise);
      • compute readOnly = !canManageLibraryUpdates;
      • pass readOnly to ReviewTabContent.
    • src/header/hooks.tsx: show the "Libraries" content-menu link based on
      canViewLibraryUpdates instead of canManageLibraryUpdates.

    4. Review tab card actions

    • src/course-libraries/ReviewTabContent.tsx:
      • thread readOnly through ReviewTabContent → ItemReviewList;
      • disable "Update" (LoadingButton) and "Ignore" buttons when read-only;
      • wrap the disabled buttons in OverlayTrigger/Tooltip (via a <span>, the
        established pattern from src/course-unit/add-component/add-component-btn);
      • keep "Review Updates" enabled;
      • pass readOnly into the preview modal.

    5. Preview modal

    • src/course-unit/preview-changes/index.tsx:
      • add optional readOnly prop (default false) so existing callers
        (OutlineNode.tsx, LibraryReferenceCard.tsx, iframe wrapper) are unaffected;
      • disable + tooltip on "Accept changes"/"Ignore changes" and the locally
        modified variants "Update to published library content"/"Keep course content".

    6. Tests

    • src/course-libraries/CourseLibraries.test.tsx:
      • default permission mock includes canViewLibraryUpdates: true;
      • permission-denied test now keys off canViewLibraryUpdates: false;
      • new tests: read-only user sees disabled Update/Ignore with tooltip on hover;
        preview modal buttons disabled with tooltip for read-only user.
    • src/course-unit/preview-changes/index.test.tsx: render modal directly with
      readOnly and assert disabled buttons + tooltip.
    • src/header/hooks.test.tsx: mocks switched to canViewLibraryUpdates.
  4. moved this from In Grooming to Blocked in RBAC AuthZ Boardon Aug 13, 2026
  5. dcoa commented on Aug 25, 2026

    @dcoa
    Contributor

    I want to verify one last thing here and that is the out of sync Alert that is displayed in the course outline and libraries updates. There is not indication of what to do with it for Course Auditor in the Figma, and keep it does not cause any harm because it redirects to Library Updates page. However, I feel the message misleading for that specific role because it says "Review updates to accept or ignore changes" -> Action that cannot perform

    Image

    I wonder if we would like to keep it as it is, or we should either hide the Alert or remove the review part of message for read only permissions.

    @BryanttV @gviedma-aulasneo

  6. moved this from Blocked to In Progress in RBAC AuthZ Boardon Aug 27, 2026
  7. gviedma-aulasneo commented on Aug 27, 2026

    @gviedma-aulasneo

    @dcoa Do we use that message somewhere else? If not, I think we can change the last sentence to 'Review updates to see what changed' and it may be less misleading.

  8. moved this from In Progress to Ready for Review in RBAC AuthZ Boardon Sep 1, 2026
  9. moved this from Ready for Review to Blocked in RBAC AuthZ Boardon Sep 1, 2026
  10. added
    willow
    on Sep 10, 2026
  11. moved this from Blocked to In Progress in RBAC AuthZ Boardon Dec 2, 2026
  12. BryanttV commented on Dec 3, 2026

    @BryanttV
    Contributor

    Hi @dcoa, the is the PR with the changes needed for library updates in the Backend. According to the product proposal, we can move forward with the changes on the Frontend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

willow

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions