Skip to content

feat: [FC-0099] redirect to admin console MFE#2570

Merged
brian-smith-tcril merged 2 commits intoopenedx:masterfrom
eduNEXT:dcoa/library-team-redirect
Oct 27, 2025
Merged

feat: [FC-0099] redirect to admin console MFE#2570
brian-smith-tcril merged 2 commits intoopenedx:masterfrom
eduNEXT:dcoa/library-team-redirect

Conversation

@dcoa
Copy link
Copy Markdown
Contributor

@dcoa dcoa commented Oct 26, 2025

Description

This PR redirects to admin console MFE if the URL is configured, to use the new experience of team management. This is part of the AuthZ Project.

The main idea of the Admin Console is having a centralized place to manage configuration including roles and perimssions. For Ulmo, we aim to have a MVP that works with libraries. For additional information about this project visit MVP - Administrative Console: AuthZ

Introduced changes
This changes only affect users with library access.

  • Add the variable ADMIN_CONSOLE_URL to configure the Admin Console MFE.
  • Validate the configuration of the URL to redirect to the MFE, otherwise open the modal.
Screencast.from.2025-10-26.13-05-29.webm

Other information

  • There is a deprecation ticket for the backend endpoints related to library team [DEPR]: Libraries' Roles and Permission System openedx-platform#37409
  • We aim to have the MFE ready for the testing release plan of Ulmo; however, the backend deprecation is targeted for Verawood. Any additional modifications to this application will be made in sync with the backend changes.

Testing instructions

MFE_CONFIG["ADMIN_CONSOLE_URL"]="http://<your_instance_host>:2025/admin-console"
  • Create a library.
  • Check the information sidebar and the manage team button for redirecting to admin console MFE.
  • If the variable is not set, then the modal should open as usual.

Best Practices Checklist

We're trying to move away from some deprecated patterns in this codebase. Please
check if your PR meets these recommendations before asking for a review:

  • Any new files are using TypeScript (.ts, .tsx).
  • Deprecated propTypes, defaultProps, and injectIntl patterns are not used in any new or modified code.
  • Tests should use the helpers in src/testUtils.tsx (specifically initializeMocks)
  • Do not add new fields to the Redux state/store. Use React Context to share state among multiple components.
  • Use React Query to load data from REST APIs. See any apiHooks.ts in this repo for examples.
  • All new i18n messages in messages.ts files have a description for translators to use.
  • Imports avoid using ../. To import from parent folders, use @src, e.g. import { initializeMocks } from '@src/testUtils'; instead of from '../../../../testUtils'

@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 26, 2025
@openedx-webhooks
Copy link
Copy Markdown

openedx-webhooks commented Oct 26, 2025

Thanks for the pull request, @dcoa!

This repository is currently maintained by @bradenmacdonald.

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
Copy link
Copy Markdown

codecov Bot commented Oct 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.78%. Comparing base (15a728d) to head (9ade181).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #2570    +/-   ##
========================================
  Coverage   94.77%   94.78%            
========================================
  Files        1225     1225            
  Lines       27393    27399     +6     
  Branches     5989     6152   +163     
========================================
+ Hits        25963    25969     +6     
  Misses       1372     1372            
  Partials       58       58            

☔ View full report in Codecov by Sentry.
📢 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.

This PR redirects to admin console MFE if the URL is configured, to leverage the new experience of team management this is part of the AuthZ project https://github.com/openedx/openedx-authz/tree/main/docs/decisions
@dcoa dcoa force-pushed the dcoa/library-team-redirect branch from 84282c9 to 32b8c19 Compare October 26, 2025 05:48
@dcoa dcoa marked this pull request as ready for review October 26, 2025 05:58
Comment on lines +35 to +44
{!adminConsoleUrl && !readOnly && (
<Button variant="outline-primary" onClick={openLibraryTeamModal}>
{intl.formatMessage(messages.libraryTeamButtonTitle)}
</Button>
)}
{adminConsoleUrl && (
<Button as={Hyperlink} variant="outline-primary" destination={`${adminConsoleUrl}/authz/libraries/${libraryId}`} target="_blank">
{intl.formatMessage(messages.libraryTeamButtonTitle)}
</Button>
)}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm curious about the logic here

Before changes in this PR

readOnly Behavior
truthy don't render a button
falsy render button to open team modal

With change in this PR

adminConsoleUrl readOnly Behavior
truthy truthy render button as link to authz
truthy falsy render button as link to authz
falsy truthy don't render a button
falsy falsy render button to open team modal

Is this the intended behavior?

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.

yes, admin console is visible for any user withhin the library team, that includes the Library User, those ones with read-only access, for better understanding this is the mapping of roles and permissions.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Glad to hear it's intended!

I'm trying to think of a way to make the intention of this logic clearer when reading the code. The best idea I've come up with so far is to add something like

// always show link to admin console MFE if it is being used
const shouldShowAdminConsoleLink = !!adminConsoleUrl;

// if the admin console MFE isn't being used, show team modal button for non–read-only users
const shouldShowTeamModalButton = !adminConsoleUrl && !readOnly;

then use shouldShowAdminConsoleLink && and shouldShowTeamModalButton && instead.

I'm very open to other ideas, and I'm also happy to land this PR as-is since the logic is already accomplishing what it is intending to accomplish.

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.

I think this definitely makes the code easier to read, I made the change

Comment on lines +35 to +44
{!adminConsoleUrl && !readOnly && (
<Button variant="outline-primary" onClick={openLibraryTeamModal}>
{intl.formatMessage(messages.libraryTeamButtonTitle)}
</Button>
)}
{adminConsoleUrl && (
<Button as={Hyperlink} variant="outline-primary" destination={`${adminConsoleUrl}/authz/libraries/${libraryId}`} target="_blank">
{intl.formatMessage(messages.libraryTeamButtonTitle)}
</Button>
)}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Glad to hear it's intended!

I'm trying to think of a way to make the intention of this logic clearer when reading the code. The best idea I've come up with so far is to add something like

// always show link to admin console MFE if it is being used
const shouldShowAdminConsoleLink = !!adminConsoleUrl;

// if the admin console MFE isn't being used, show team modal button for non–read-only users
const shouldShowTeamModalButton = !adminConsoleUrl && !readOnly;

then use shouldShowAdminConsoleLink && and shouldShowTeamModalButton && instead.

I'm very open to other ideas, and I'm also happy to land this PR as-is since the logic is already accomplishing what it is intending to accomplish.

@sarina sarina moved this to Ready for Development in RBAC AuthZ Board Oct 27, 2025
@sarina sarina moved this from Ready for Development to Ready for review in RBAC AuthZ Board Oct 27, 2025
@MaferMazu MaferMazu added the release blocker Blocks the upcoming release (fix needed) label Oct 27, 2025
@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Oct 27, 2025
@mphilbrick211 mphilbrick211 moved this from Needs Triage to In Eng Review in Contributions Oct 27, 2025
@brian-smith-tcril brian-smith-tcril enabled auto-merge (squash) October 27, 2025 15:58
@brian-smith-tcril brian-smith-tcril merged commit 0972b7e into openedx:master Oct 27, 2025
7 checks passed
@github-project-automation github-project-automation Bot moved this from In Eng Review to Done in Contributions Oct 27, 2025
@github-project-automation github-project-automation Bot moved this from Ready for review to Done in RBAC AuthZ Board Oct 27, 2025
ChrisChV pushed a commit that referenced this pull request Nov 3, 2025
Updates navbar in library authoring page to include `Team Access` and `Import` menu options. Clicking on `Team Access` button opens Team management modal.

As per this new PR: #2570, if admin console url is set, it should be used instead of team access modal. So updated this PR accordingly.
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). FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U release blocker Blocks the upcoming release (fix needed)

Projects

Archived in project
Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants