Skip to content

Adds the create custom role wizard for the name and resource (step 1) - #293

Merged
jacobo-dominguez-wgu merged 7 commits into
masterfrom
jacobo/create-role-wizard-1
Dec 3, 2026
Merged

jacobo-dominguez-wgu merged 7 commits into
masterfrom
jacobo/create-role-wizard-1

Conversation

@jacobo-dominguez-wgu

@jacobo-dominguez-wgu jacobo-dominguez-wgu commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds the "Create Custom Role" header button on the Roles and Permissions tab. It opens a full-screen "Create a new role" wizard with a two-step stepper, and builds the first step (Name & Resource). The Permissions step is a placeholder until #572.

Closes openedx/openedx-authz#571
Design figma
Requires openedx/openedx-authz#666

Changes

  • Header button. CreateCustomRole shows on the Roles and Permissions tab only. AuthzHome now controls the active tab so the header actions follow it.
  • Wizard shell. A FullscreenModal wrapped in a Paragon Stepper ("Name & Resource" then "Permissions"). It is mounted only while open, so each opening starts from an empty draft. Cancel and Esc close it.
  • Step 1, NameAndResourceStep:
    • A role name field, with the helper text from the ticket.
    • Two selectable "Start from" cards: "Start from scratch" and "Clone from role".
    • In scratch mode, a resource type dropdown.
    • In clone mode, the dropdown is replaced by a grouped role picker: "Standard Roles" split by resource type, and "Custom Roles". Both can be cloned.
  • Draft state, customRoleDraft.ts. getCustomRoleSeed returns the resource type and permissions the Permissions step starts from, or null while an answer is missing, which keeps Next blocked. A clone takes its resource type and a copy of its permissions from the source role, so the type can't differ from it.
  • Reuse. NameAndResourceStep uses RESOURCE_TYPE_DISPLAY and the catalog's isCustomRole, so it adds no second map of scope type icons and labels.
  • Accessibility:
    • Each step's content is a named group ("Step 1 of 2: Name & Resource"), and focus moves to it when the step changes.
    • The "Start from" cards are a roving-tabindex radio group that works with the arrow keys.
    • The role picker is a role="menu" of menuitemradio items with aria-checked. It focuses its first item when opened by keyboard.
    • Next uses aria-disabled instead of disabled, with a screen reader hint about what is missing. Pressing it while blocked shows the errors and focuses the first missing answer.
  • Header changes beyond the ticket. AddRoleButton gets the PersonAdd icon and an outline variant while the roles tab is active. AuthZTitle drops the divider between actions and uses a gap instead. The wizard chrome in index.scss is shared with the assign role wizard.
  • Validates the role name provided before moving to step 2, shows an inline error if the role name is not valid and disables the next button until the name is changed.

Demo

Screen.Recording.2026-11-24.at.9.10.06.AM.mov

Testing

Testing guide: Create Custom Role, step 1
Setup: a user who can view course or library teams. Create a custom role first, or the "Custom Roles" group won't show.

  1. Button: "Create Custom Role" shows only on the Roles and Permissions tab, not on Team Members.
  2. Open: click it. The "Create a new role" dialog opens on "Name & Resource".
  3. Name: click Next with no name. "Enter a role name." appears and focus moves to the field. A name of spaces only is still rejected.
  4. Scratch (default): the resource type dropdown lists Courses and Libraries, and the role picker is hidden.
  5. Clone: The dropdown becomes a "Role" picker. Next without a pick shows "Select a role to clone."
    The picker shows "Standard Roles" (split by Courses and Libraries) and "Custom Roles". Picking either enables Next.
  6. Next and Back: Next opens an empty step 2. Back keeps your entries.
  7. Close: Cancel and Esc both close the dialog and return focus to the button. Reopening starts empty.
  8. Keyboard:
    The arrow keys move between the "Start from" cards.
    Enter opens the picker on its first role.
  9. Error: if the roles request fails, the dialog shows an error and Next stays blocked.
  10. Error: enter an invalid or duplicated role name shows an inline error bellow the role name input and Next stays blocked.

AI Usage

Used kiro with claude opus 5.5 to assist with the plan and creation of this feature.

@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 Nov 24, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @jacobo-dominguez-wgu!

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 Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.43503% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 99.16%. Comparing base (707838f) to head (64fe2f8).

Files with missing lines Patch % Lines
...les-permissions/components/NameAndResourceStep.tsx 98.78% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #293      +/-   ##
==========================================
+ Coverage   99.14%   99.16%   +0.02%     
==========================================
  Files         100      103       +3     
  Lines        1752     1923     +171     
  Branches      557      619      +62     
==========================================
+ Hits         1737     1907     +170     
- Misses         15       16       +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.

@jacobo-dominguez-wgu
jacobo-dominguez-wgu force-pushed the jacobo/create-role-wizard-1 branch 2 times, most recently from 1a82679 to ad9cd80 Compare November 24, 2026 16:14
Base automatically changed from jacobo/assign-role-row to master November 24, 2026 16:25
@jacobo-dominguez-wgu
jacobo-dominguez-wgu force-pushed the jacobo/create-role-wizard-1 branch from ad9cd80 to 22eca09 Compare November 24, 2026 16:25
@mphilbrick211 mphilbrick211 added the mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). label Nov 24, 2026
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Ready for Review in Contributions Nov 24, 2026
@jacobo-dominguez-wgu
jacobo-dominguez-wgu force-pushed the jacobo/create-role-wizard-1 branch from 22eca09 to d304a9b Compare November 25, 2026 18:30
@jacobo-dominguez-wgu
jacobo-dominguez-wgu requested review from bra-i-am, dcoa, diana-villalvazo-wgu and rodmgwgu and removed request for dcoa November 26, 2026 18:56

@rodmgwgu rodmgwgu left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for this!, haven't tested it all but I'm posting my findings so far.

Comment thread src/authz-module/authz-home/index.tsx Resolved
@rodmgwgu

Copy link
Copy Markdown

One thing to consider that is not specified in the design: Custom role names should be unique as specified in ADR 0036.

This means that perhaps we should have a way to validate the name before leaving the first page of the wizard, otherwise we won't see the error until the final submission.

What do you think @maguilarUXUI @jacobo-dominguez-wgu ?

@rodmgwgu rodmgwgu left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Tested in my local and, other than my previous comments, it's working correctly. Thanks!

@jacobo-dominguez-wgu

Copy link
Copy Markdown
Contributor Author

One thing to consider that is not specified in the design: Custom role names should be unique as specified in ADR 0036.

This means that perhaps we should have a way to validate the name before leaving the first page of the wizard, otherwise we won't see the error until the final submission.

What do you think @maguilarUXUI @jacobo-dominguez-wgu ?

Agreed, a duplicate name should be caught on step 1, like the assign role wizard validates before moving on, instead of failing at final submit. This would need a new endpoint to check name availability, which doesn't exist yet. Once it's available, I'll validate on Next and show an inline error on the name field.

@rodmgwgu

Copy link
Copy Markdown

One thing to consider that is not specified in the design: Custom role names should be unique as specified in ADR 0036.
This means that perhaps we should have a way to validate the name before leaving the first page of the wizard, otherwise we won't see the error until the final submission.
What do you think @maguilarUXUI @jacobo-dominguez-wgu ?

Agreed, a duplicate name should be caught on step 1, like the assign role wizard validates before moving on, instead of failing at final submit. This would need a new endpoint to check name availability, which doesn't exist yet. Once it's available, I'll validate on Next and show an inline error on the name field.

@jacobo-dominguez-wgu Here is the PR for the validate-name endpoint: openedx/openedx-authz#666

@jacobo-dominguez-wgu

Copy link
Copy Markdown
Contributor Author

One thing to consider that is not specified in the design: Custom role names should be unique as specified in ADR 0036.
This means that perhaps we should have a way to validate the name before leaving the first page of the wizard, otherwise we won't see the error until the final submission.
What do you think @maguilarUXUI @jacobo-dominguez-wgu ?

Agreed, a duplicate name should be caught on step 1, like the assign role wizard validates before moving on, instead of failing at final submit. This would need a new endpoint to check name availability, which doesn't exist yet. Once it's available, I'll validate on Next and show an inline error on the name field.

@jacobo-dominguez-wgu Here is the PR for the validate-name endpoint: openedx/openedx-authz#666

Thanks this was implemented here abcd7ab
image

Comment thread src/authz-module/authz-home/index.tsx Resolved
Comment thread src/authz-module/authz-home/index.tsx Outdated
const presetScope = searchParams.get('scope')?.replace(/\s/g, '+') || undefined;

const showCreateCustomRole = useMemo(() => {
return getAuthenticatedUser()?.administrator ? activeTab === 'permissionsRoles' : false;

@dcoa dcoa Nov 30, 2026 •

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.

If I think in terms of accessibility I would prefer that the buttons at header do not depend of the tab changes because someone using screen reader might missing:

  • when someone is navigating with a screen reader the button is not render at the first page read.
  • When navigation with the keyboard use move forward so the focus pass for the tab to the tab content. And nothing announce the button until the user navigates back (and hopefully haven't change the tab)

I also think in terms of usability and hierarchy is not the best workflow.

While is not mandatory the web standards suggest that element/tags generated form an action should be inserted right after the trigger. Following that, if we want to keep the dependency, the Custom Roles button should be place inside the tab.

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.

Totally agree, will discuss with design to came up with a better solution.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I agree. Actually, the first proposal keeps the same buttons across all tabs, so we can go back to that design. What do you think, @rodmgwgu?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Agree, thanks!

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.

@maguilarUXUI Could you tell me which design you are referring to?

@jacobo-dominguez-wgu
jacobo-dominguez-wgu force-pushed the jacobo/create-role-wizard-1 branch 2 times, most recently from 644adb9 to ac4124f Compare December 1, 2026 22:02
</Button>
<Stepper.ActionRow.Spacer />
{/* aria-disabled, not disabled, so Next stays focusable and can say what is missing. */}
<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.

Shouldn't next be a stateful button like we do with Assign Role modal?

return;
}
try {
const result = await validateRoleName(effectiveDraft.name);

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.

lets trim the value before send it to the backend.

Comment thread src/authz-module/authz-home/index.tsx Outdated
const presetScope = searchParams.get('scope')?.replace(/\s/g, '+') || undefined;

const showCreateCustomRole = useMemo(() => {
return (getAuthenticatedUser()?.administrator || getAuthenticatedUser()?.superuser) ? activeTab === 'permissionsRoles' : false;

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.

You can use the new hook useCanManageRoles for this platform roles.

@jacobo-dominguez-wgu
jacobo-dominguez-wgu force-pushed the jacobo/create-role-wizard-1 branch from ac4124f to 6fcad56 Compare December 2, 2026 18:16

@rodmgwgu rodmgwgu left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for attending to my comments, tested again in my local and it's worked correctly, LGTM!

@dcoa dcoa left a comment

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.

Thanks, I think this is good to go

@jacobo-dominguez-wgu
jacobo-dominguez-wgu merged commit 5e6f3ce into master Dec 3, 2026
6 checks passed
@jacobo-dominguez-wgu
jacobo-dominguez-wgu deleted the jacobo/create-role-wizard-1 branch December 3, 2026 15:32
@github-project-automation github-project-automation Bot moved this from Ready for Review to Done in Contributions Dec 3, 2026
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: Done

Development

Successfully merging this pull request may close these issues.

Frontend: Create Custom Role button + wizard page 1 (Name & Resource)

6 participants