generated from openedx/frontend-template-application
-
Notifications
You must be signed in to change notification settings - Fork 4
feat(authz): [FC-0099] permissions tab #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
brian-smith-tcril
merged 8 commits into
openedx:master
from
eduNEXT:dcoa/permissions-tab
Oct 23, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
00c1b25
feat: create permissions tab
dcoa 4312440
style: add tsdocs to getPermissionMetadata and buildPermissionMatrix
dcoa 351e172
style: fix padding on rows table
dcoa a144f44
feat: add skeleton and improve testing
dcoa f4c0e33
feat: create ResourceTooltip component and enhance types for permissi…
dcoa 48efee0
style: enhance tooltip styles and permissions displayed order
dcoa 14a631b
test: remove data-testid for PermissionTable
dcoa c7cd081
style: use card for adding background color to the permission table c…
dcoa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import { Check, Close } from '@openedx/paragon/icons'; | ||
| import { Card, Icon } from '@openedx/paragon'; | ||
| import { PermissionsResourceGrouped, Role } from '@src/types'; | ||
| import { actionsDictionary } from './RoleCard/constants'; | ||
| import ResourceTooltip from './ResourceTooltip'; | ||
|
|
||
| type PermissionTableProps = { | ||
| roles: Role[]; | ||
| permissionsTable: PermissionsResourceGrouped[]; | ||
| }; | ||
|
|
||
| const PermissionTable = ({ permissionsTable, roles }: PermissionTableProps) => ( | ||
| <Card> | ||
| <table className="permission-table w-100"> | ||
| <thead> | ||
| <tr> | ||
| <th className="" aria-hidden="true" /> | ||
| {roles.map(role => ( | ||
| <th key={role.name} className="text-center py-3">{role.name}</th> | ||
| ))} | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| {permissionsTable.map(resourceGroup => ( | ||
| <> | ||
| <tr className="bg-info-100 text-primary"> | ||
| <td colSpan={roles.length + 1} className="text-start py-3 px-4"> | ||
| <strong>{resourceGroup.label}</strong> | ||
| <ResourceTooltip resourceGroup={resourceGroup} /> | ||
| </td> | ||
| </tr> | ||
| {resourceGroup.permissions.map(permission => ( | ||
| <tr key={permission.key} className="border-top"> | ||
| <td className="text-start d-flex align-items-center small px-4 py-3"> | ||
| <Icon className="d-inline-block mr-2" size="sm" src={actionsDictionary[permission.actionKey]} /> | ||
| {permission.label} | ||
| </td> | ||
| {roles.map(role => ( | ||
| <td key={role.name} className="text-center"> | ||
| {permission.roles[role.name] ? <Icon className="d-inline-block" src={Check} /> : <Icon className="text-danger d-inline-block" src={Close} />} | ||
| </td> | ||
| ))} | ||
| </tr> | ||
| ))} | ||
| </> | ||
| ))} | ||
| </tbody> | ||
| </table> | ||
| </Card> | ||
| ); | ||
|
|
||
| export default PermissionTable; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { Icon, OverlayTrigger, Popover } from '@openedx/paragon'; | ||
| import { Info } from '@openedx/paragon/icons'; | ||
| import { PermissionsResourceGrouped, RoleResourceGroup } from '@src/types'; | ||
|
|
||
| type ResourceTooltipProps = { | ||
| resourceGroup: PermissionsResourceGrouped | RoleResourceGroup; | ||
| }; | ||
|
|
||
| const ResourceTooltip = ({ resourceGroup }:ResourceTooltipProps) => ( | ||
| <OverlayTrigger | ||
| key={`overlay-${resourceGroup.key}`} | ||
| placement="auto" | ||
| overlay={( | ||
| <Popover id={`tooltip-${resourceGroup.label}`}> | ||
| <Popover.Content className="p-3"> | ||
| <h4 className="text-primary">{resourceGroup.label}</h4> | ||
| <p className="small">{resourceGroup.description}</p> | ||
| <ul className="small"> | ||
| {resourceGroup.permissions.map(permission => ( | ||
| <li><b>{permission.label.trim()}:</b> {permission.description}</li> | ||
| ))} | ||
| </ul> | ||
| </Popover.Content> | ||
| </Popover> | ||
| )} | ||
| > | ||
| <Icon className="d-inline-block text-gray ml-2 my-auto" size="inline" src={Info} /> | ||
| </OverlayTrigger> | ||
| ); | ||
|
|
||
| export default ResourceTooltip; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,12 @@ | |
| height: var(--pgn-size-icon-xs); | ||
| } | ||
| } | ||
|
|
||
| .permission-table { | ||
| td { | ||
| line-height: 24px; | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious as to what color we want the checkmarks to be
Current
"Success"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original design has no specific color https://www.figma.com/design/q3Knq0BKoVTBbtaxb81n9R/RBAC---Console---Wireframes?node-id=2750-9661&t=hu3T5aVg659Dg0J2-4
Do you consider the green is a better indicative?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm perfectly happy with it either way. I just saw "
text-danger" for the red X and my mind jumped to usingtext-successfor a green check, but if the designs don't have it as green then it's good as is.