Skip to content

feat(authz): add the AuthZ catalog feature - #262

Open
dcoa wants to merge 6 commits into
masterfrom
dcoa/catalog-1-feature
Open

dcoa wants to merge 6 commits into
masterfrom
dcoa/catalog-1-feature

Conversation

@dcoa

@dcoa dcoa commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add a shared AuthZ catalog feature that prepares the Admin Console to consume backend-defined roles, permissions, and categories.

How it works:

  • Validate view-team permissions
  • Fetch the catalog for viewable scope types
  • Merge all role pages
  • Expose a filtered catalog for each scope type

The feature provides:

  • useAuthzCatalog, with shared caching and stable per-scope catalogs.
  • Scope filtering and role ordering by descending permission count.
  • CatalogIcon, which loads Paragon icons by name and preserves spacing when an icon is loading or unknown.
  • Shared types, test helpers, and an architecture decision record.

This PR introduces the catalog infrastructure only. Existing screens do not consume it yet.

Depends on openedx/openedx-authz#510, available in openedx-authz==2.0.0.

Evidence

Before: Roles, permissions, and categories are hardcoded in the frontend.

After: A reusable catalog module can retrieve these definitions from the backend for future screen migrations.

Added tests cover permission-based fetching, pagination, scope filtering, stable catalog references, role ordering, and icon rendering.

Test instructions

From the PR branch, install dependencies and run:

npm ci
npm test -- --watch=false --runInBand src/authz-module/catalog
npm run types
npm run lint

Verify that the catalog tests cover:

  • Fetching both supported scope types when the user can view both teams.
  • Fetching only the library catalog when only library-team access is allowed.
  • Waiting for permission validation and skipping the catalog request when neither scope type is viewable.
  • Combining paginated roles in page order.
  • Filtering roles, permissions, and categories by scope type.
  • Sorting roles by permission count while preserving catalog order for ties.
  • Rendering valid icons, preserving an empty placeholder for unknown names, and rendering nothing for a null icon.

Run the full regression suite:

npm test -- --watch=false --runInBand

No visible UI change is expected because screen integration will follow in subsequent PRs. If you want to try the integration in a small component test #263 or if yuo want to tes the full implementation check #270

AI disclosure

Code assisted by Claude

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

openedx-webhooks commented Oct 15, 2026 •

Copy link
Copy Markdown

Thanks for the pull request, @dcoa!

This repository is currently maintained by @openedx/committers-frontend.

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 Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.60%. Comparing base (5fc4953) to head (8cb1f97).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #262      +/-   ##
==========================================
+ Coverage   98.55%   98.60%   +0.04%     
==========================================
  Files          80       84       +4     
  Lines        1385     1430      +45     
  Branches      468      476       +8     
==========================================
+ Hits         1365     1410      +45     
  Misses         19       19              
  Partials        1        1              

☔ 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.

@dcoa
dcoa added this pull request to stack #265 October 15, 2026 03:17
@dcoa
dcoa force-pushed the dcoa/catalog-1-feature branch 3 times, most recently from f550481 to d355afd Compare October 15, 2026 07:06
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Oct 22, 2026
@dcoa dcoa self-assigned this Oct 28, 2026
@dcoa
dcoa marked this pull request as ready for review October 28, 2026 05:33
@dcoa
dcoa requested review from BryanttV, arbrandes, bra-i-am, jacobo-dominguez-wgu and rodmgwgu and removed request for arbrandes October 28, 2026 06:11
@dcoa
dcoa force-pushed the dcoa/catalog-1-feature branch from 7eb0833 to d9cd96d Compare October 28, 2026 06:16
Comment thread docs/decisions/0004-authz-catalog.rst Resolved
* While the icon loads, and when the name is unknown, it renders an empty icon of the same size, so
* the layout doesn't shift. When the catalog sends no icon, it renders nothing.
*/
const CatalogIcon = ({ name, ...iconProps }: CatalogIconProps) => {

@dcoa dcoa Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

There was a recent review at the backend openedx/openedx-authz#537 (comment) and we are going to use a set of icon names agreed between the front and the backend, so at the front side we will have a map of icons.

We could still review this and subsequent PRs, understanding that once the set of icons are defined it only affects this file and not consumers.

dcoa and others added 5 commits October 29, 2026 20:00
Fetch the roles, permissions and categories catalog of the scope types the user can view, slice it by scope type, order its roles by permission count, and render its icons by name with CatalogIcon. Nothing consumes it yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants