Skip to content

feat: Role Detail View/Members Tab Management Feature - #294

Merged
diana-villalvazo-wgu merged 22 commits into
openedx:masterfrom
WGU-Open-edX:diana/members-tab
Dec 1, 2026
Merged

diana-villalvazo-wgu merged 22 commits into
openedx:masterfrom
WGU-Open-edX:diana/members-tab

Conversation

@diana-villalvazo-wgu

@diana-villalvazo-wgu diana-villalvazo-wgu commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implemented role detail page enabling users to view and manage members assigned to standard and custom roles. Users can now navigate to individual role details, search/filter members, assign new members, and manage member lifecycle.

Note:
Same PR as #291 but got closed after comparing base branch was deleted 😅

Changes

New Features

  • Role Detail Page: Main view showing role metadata with Members and Permissions tabs

    • Duplicate Button (Standard Roles)
    • Edit button for role name editing (Custom Roles)
    • MoreVert dropdown menu with Duplicate and Delete actions (Custom Roles)
    • PersonAdd button to open member assignment wizard
  • Members Table: Display members filtered by role with search and scope filtering

    • Username search
    • Scope-based filtering
    • Pagination with configurable page size
    • Proper data flattening for nested assignments
  • Member Actions: Per-row action buttons

    • View: Navigate to member audit page (eye icon)
    • Delete: Remove member from role (trash icon)

Technical Decisions

Role ID over Name: Uses roleId for filtering instead of URL-encoded roleName to avoid encoding/decoding complexity.

Use Assignments endpoint: We decided to use /api/authz/v1/assignments/ (updated with the display name of scope and organization - PR) due to useTeamMembersAssignments defaults to returning the first 3 assignments per user. A user holding the same role in more than three scopes therefore appears only three times, leaving the remaining scopes undisplayed.

Remaining Tasks (Part of other GH issues/epics)

  • Delete member action: IconButton (needs implementation)
  • Duplicate role action: Menu item and Button (needs implementation)
  • Delete role action: Menu item (needs implementation)
  • Edit role name: Button (needs modal/inline edit)
  • Permissions tab: Empty placeholder (needs implementation)
  • Modify Wizard to take current role instead of allowing to chose others (needs implementation)

Screenshots

Standard Role

Screenshot 2026-11-26 at 5 41 28 p m

Custom Role

Screenshot 2026-11-26 at 5 41 06 p m

Support Info

Closes openedx/openedx-authz#575

LLM Usage

Built with assistance from 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 Nov 24, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @diana-villalvazo-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.

@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Nov 24, 2026
@diana-villalvazo-wgu diana-villalvazo-wgu moved this from Needs Triage to Ready for Review in Contributions Nov 24, 2026
@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.14%. Comparing base (8394de7) to head (b58491c).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #294      +/-   ##
==========================================
+ Coverage   99.07%   99.14%   +0.07%     
==========================================
  Files          90       99       +9     
  Lines        1615     1748     +133     
  Branches      530      519      -11     
==========================================
+ Hits         1600     1733     +133     
  Misses         15       15              

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

@diana-villalvazo-wgu
diana-villalvazo-wgu force-pushed the diana/members-tab branch 2 times, most recently from 342cd95 to 5528a7f Compare November 25, 2026 23:07

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

nit: Please update the PR description to reflect the latest changes and mention that it depends on openedx-authz#653

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

I've been testing this in my local and is looking good, just found some details to address, also, I see that for custom roles we are missing the resource-type indicator and the last updated date, and the edit warning.

Screenshot 2026-11-26 at 12 43 06 p m

Also, are we validating if the user is superuser for hiding or disabling the edit and duplicate functions?

Comment thread src/authz-module/constants.ts Resolved
src={Edit}
iconAs={Icon}
size="sm"
alt={intl.formatMessage(messages['authz.custom.role.edit.name.alt'])}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It was decided in ADR 0036 that custom role names won't be editable once created, so we should remove this.

@rodmgwgu

Copy link
Copy Markdown

@maguilarUXUI I'm seeing that in the design we don't have anywhere to show or edit the role description, should we add that in this view?

@jacobo-dominguez-wgu jacobo-dominguez-wgu 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.

I am testing this locally and I see the scope filter shows options including all the resource types, like in the next example the role Course Admin specific for courses, the scope filter shows libraries options.
image

Should the filter display only resources of the same resource_type of the role?

Comment thread src/authz-module/messages.ts Resolved
{!isCustom && <DuplicateRoleButton />}
<AddRoleButton key="add-role-button" iconBefore={PersonAdd} />
</Stack>
]}

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.

The figma design shows an edit icon button and a warning alert for custom roles, those are missing here, are they going to be part of an upcoming pr?

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.

Rod ask me to remove the edit button since on an ADR they decided to not allow custom role name to be edited, the alert will be added later.

@diana-villalvazo-wgu

Copy link
Copy Markdown
Contributor Author

validating if the user is superuser for hiding or disabling the edit and duplicate functions?

shouldn't we do that validation before showing the edit button(for custom roles) on the prev page? or the edit is enabled for everyone and they can see but not do actions if they are not allowed to?

cc. @jacobo-dominguez-wgu @rodmgwgu

@rodmgwgu

Copy link
Copy Markdown

validating if the user is superuser for hiding or disabling the edit and duplicate functions?

shouldn't we do that validation before showing the edit button(for custom roles) on the prev page? or the edit is enabled for everyone and they can see but not do actions if they are not allowed to?

cc. @jacobo-dominguez-wgu @rodmgwgu

Yes, everywhere where these superuser-only actions appear should be validated and hidden when the user is not superuser.

// Adding 2 actions as a stack since we don't want to have a divider between them
<Stack direction="horizontal" gap={2} key="role-actions">
{!isCustom && <DuplicateRoleButton />}
<AddRoleButton key="add-role-button" iconBefore={PersonAdd} />

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Add role shouldn't be restricted to superusers only, it has it's own canAssignRole check.

Only the DuplicateRoleButton should be guarded behind canManageRoles.

onClick={handleViewUser}
alt={formatMessage(messages['authz.role.members.table.action.view.alt'], { username: member.username })}
/>
<IconButton

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The Delete action should be guarded by the following permissions: courses.manage_course_team for course assignments and content_libraries.manage_library_team for library assignments.

See how audit-user page already does it.

@dcoa dcoa Dec 1, 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.

Actually, wouldn’t it be better to reuse the delete action from the user assignments table?

It already uses canManageScope to enable deletion, respects the course-authoring flag, prevents removing your own admin role, and handles Django-managed roles with explanatory tooltips.

I don’t see a different delete workflow in Figma (1-to-1 action), so sharing the action and its confirmation/revocation flow could help keep both tables consistent. It would need some refactoring, but we could reuse the existing behavior instead of implementing it again. What do you think?

No need to include this in this PR, as it’s already quite large, just leaving the idea here for consideration.

*/
export const useCanManageRoles = (): boolean => {
const { authenticatedUser } = useContext(SiteContext);
return authenticatedUser?.administrator === true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This check doesn't cover all cases that the backend consider as 'superusers'. Currently the backend checks if a user is staff, or if they are superuser. This is only checking if a user is staff.

This seems to be an issue that comes from frontend-base, this is what Kiro had to say:

Is there a claim for superusers?

Yes. The backend already sends one, but frontend-base drops it before it reaches the app.

  1. openedx-platform adds both flags to the access token. In /Users/rodrigo.mendez/oexenvs/main/repos/openedx-platform/openedx/core/djangoapps/oauth_dispatch/jwt.py:275-276:
    'administrator': user.is_staff,
    'superuser': user.is_superuser,
  2. frontend-base copies only administrator. In @openedx/frontend-base 2.0.0-alpha.12, AxiosJwtAuthService.fetchAuthenticatedUser builds authenticatedUser from email, userId, username, roles, administrator and name. The superuser claim never reaches SiteContext.authenticatedUser, and types.d.ts doesn't declare it.

Best solution:

  • Add superuser to authenticatedUser in frontend-base. It's one field in fetchAuthenticatedUser plus the type. Then useCanManageRoles becomes administrator === true || superuser === true. This needs a frontend-base PR.

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.

Here is the frontend-base pr openedx/frontend-base#366

import { EmailCell, NameCell } from '@src/authz-module/team-members/components/TeamMemberCells';
import { ScopeSummaryCell } from '@src/authz-module/components/TableCells';
import { getCellHeader, getScopeManageActionPermission } from '@src/authz-module/utils';
import { useValidateUserPermissionsNonSuspense } from '@src/data/hooks';

@dcoa dcoa Dec 1, 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.

Could we use usePermissions from @openedx/frontend-base here? We’re planning to remove useValidateUserPermissionsNonSuspense, so it would be nice to avoid adding new usages.

useAssignableRoleGroups already uses it as an example. The query here would still need to check the manage-team permission for each specific scope.

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

LGTM!, thanks for addressing my comments!

@jacobo-dominguez-wgu jacobo-dominguez-wgu 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.

LGTM!

@diana-villalvazo-wgu
diana-villalvazo-wgu merged commit d953abb into openedx:master Dec 1, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from Ready for Review to Done in Contributions Dec 1, 2026
@diana-villalvazo-wgu
diana-villalvazo-wgu deleted the diana/members-tab branch December 1, 2026 20:34
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: Done

Development

Successfully merging this pull request may close these issues.

Frontend: Role detail view Members tab

5 participants