Repository navigation
Adds the create custom role wizard for the name and resource (step 1) - #293
Conversation
|
Thanks for the pull request, @jacobo-dominguez-wgu! This repository is currently maintained by 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 approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo 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:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere 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:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
1a82679 to
ad9cd80
Compare
ad9cd80 to
22eca09
Compare
22eca09 to
d304a9b
Compare
rodmgwgu
left a comment
There was a problem hiding this comment.
Thanks for this!, haven't tested it all but I'm posting my findings so far.
|
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
left a comment
There was a problem hiding this comment.
Tested in my local and, other than my previous comments, it's working correctly. Thanks!
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 |
| const presetScope = searchParams.get('scope')?.replace(/\s/g, '+') || undefined; | ||
|
|
||
| const showCreateCustomRole = useMemo(() => { | ||
| return getAuthenticatedUser()?.administrator ? activeTab === 'permissionsRoles' : false; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Totally agree, will discuss with design to came up with a better solution.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
@maguilarUXUI Could you tell me which design you are referring to?
644adb9 to
ac4124f
Compare
| </Button> | ||
| <Stepper.ActionRow.Spacer /> | ||
| {/* aria-disabled, not disabled, so Next stays focusable and can say what is missing. */} | ||
| <Button |
There was a problem hiding this comment.
Shouldn't next be a stateful button like we do with Assign Role modal?
| return; | ||
| } | ||
| try { | ||
| const result = await validateRoleName(effectiveDraft.name); |
There was a problem hiding this comment.
lets trim the value before send it to the backend.
| const presetScope = searchParams.get('scope')?.replace(/\s/g, '+') || undefined; | ||
|
|
||
| const showCreateCustomRole = useMemo(() => { | ||
| return (getAuthenticatedUser()?.administrator || getAuthenticatedUser()?.superuser) ? activeTab === 'permissionsRoles' : false; |
There was a problem hiding this comment.
You can use the new hook useCanManageRoles for this platform roles.
Next calls POST /api/authz/v1/roles/validate-name/ and only moves to the permissions step when the name is available. A taken or invalid name shows its error under the name field and disables Next until the name changes.
ac4124f to
6fcad56
Compare
6fcad56 to
64fe2f8
Compare
rodmgwgu
left a comment
There was a problem hiding this comment.
Thanks for attending to my comments, tested again in my local and it's worked correctly, LGTM!
dcoa
left a comment
There was a problem hiding this comment.
Thanks, I think this is good to go

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
CreateCustomRoleshows on the Roles and Permissions tab only.AuthzHomenow controls the active tab so the header actions follow it.FullscreenModalwrapped in a ParagonStepper("Name & Resource" then "Permissions"). It is mounted only while open, so each opening starts from an empty draft. Cancel and Esc close it.NameAndResourceStep:customRoleDraft.ts.getCustomRoleSeedreturns the resource type and permissions the Permissions step starts from, ornullwhile 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.NameAndResourceStepusesRESOURCE_TYPE_DISPLAYand the catalog'sisCustomRole, so it adds no second map of scope type icons and labels.role="menu"ofmenuitemradioitems witharia-checked. It focuses its first item when opened by keyboard.aria-disabledinstead ofdisabled, with a screen reader hint about what is missing. Pressing it while blocked shows the errors and focuses the first missing answer.AddRoleButtongets thePersonAddicon and an outline variant while the roles tab is active.AuthZTitledrops the divider between actions and uses a gap instead. The wizard chrome inindex.scssis shared with the assign role wizard.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.
The picker shows "Standard Roles" (split by Courses and Libraries) and "Custom Roles". Picking either enables Next.
The arrow keys move between the "Start from" cards.
Enter opens the picker on its first role.
AI Usage
Used kiro with claude opus 5.5 to assist with the plan and creation of this feature.