Skip to content

UIU-3550 Render links to role details in role lists. - #3072

Merged
JohnC-80 merged 18 commits into
masterfrom
UIU-3550
Sep 22, 2026
Merged

JohnC-80 merged 18 commits into
masterfrom
UIU-3550

Conversation

@JohnC-80

@JohnC-80 JohnC-80 commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

UIU-3550

Setting up links in Role lists on the use details page, the edit page and in the role selection modal.

The links will only render if:

  • the user has permission to view the role detail page
  • the user is viewing their login affiliation in the dropdown

All links open a new tab.

2026-09-10_16h04_22.mp4

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Jest Unit Test Results

    1 files  ± 0    295 suites  +1   5m 15s ⏱️ -28s
1 593 tests +10  1 590 ✅ +10  3 💤 ±0  0 ❌ ±0 
1 629 runs  +10  1 626 ✅ +10  3 💤 ±0  0 ❌ ±0 

Results for commit d6e4e52. ± Comparison against base commit 65adc70.

♻️ This comment has been updated with latest results.

@JohnC-80
JohnC-80 requested a review from a team September 11, 2026 17:52

@zburke zburke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  1. Is there a 1::1 correspondence between "can see the roles assigned to a user in ui-users" and "can see the role details in settings in ui-authorization-roles"? If yes, great. If not, all these changes need to be guarded by <IfPermission>, showing a link when the user has permission and the bare role-name otherwise.
  2. Why do the links open in a new tab? This is inconsistent with how other links in FOLIO behave and is not specified in the ticket.

@JohnC-80

JohnC-80 commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Is there a 1::1 correspondence between "can see the roles assigned to a user in ui-users" and "can see the role details in settings in ui-authorization-roles"?

@zburke Good catch thank you! There is, in fact, a separate perm for reaching the Settings > Role details page. Will include a check for it.

Why do the links open in a new tab? This is inconsistent with how other links in FOLIO behave and is not specified in the ticket.

New tab works for forms/modals where there's some state that's potentially lost with navigation. Since these are included on the edit form, the details form just follows for consistency. This is has been regarded as something that could easily change later depending on user feedback.

@zburke zburke left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@JohnC-80, 👌, I'm requesting changes for the missing <IfPermission> checks.

Opening links from a modal in a new window is sensible to avoid the navigation prompt. I like that pattern. Can/should we document it on the TextLink readme? On the TextLink storybook? I'm not convinced it's the right pattern, however, when a role-name is displayed in an accordion on the main window. If you want to leave this as-is, ok, but I think there's a solid argument that only the modal's links should behave this way.

@JohnC-80

Copy link
Copy Markdown
Contributor Author

@zburke Wrapped the permission check up in a small component and used that in place of the role names. 🧹

@JohnC-80
JohnC-80 requested a review from zburke September 17, 2026 21:02
@JohnC-80

Copy link
Copy Markdown
Contributor Author

Included an additional check to see if the user has their login affiliation selected from the Affiliations dropdown. If the selected affiliation is different, getting the data for the role details page will fail.

@zburke zburke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Functionally, this gets the job done: links are present on roles that match the current tenant of the authenticated user, otherwise, the role name is displayed. So, approved ✅

That said, I had a hard time with the renaming of the return value from matchesLoginTenant as it was drilled through to RoleNameLink. It effectively gets renamed to viewingLoginAffiliation in EditUserRoles, and then to canRenderLink in RoleNameLink. It's likewise renamed to displayRoleDetailLinks in UserRolesModal and UserRolesList. Additionally, is "login-tenant" really the right label, or is it actually "current-tenant"?

Maybe contexts (for each user's affiliations, and nested within that for each user's currently-selected affiliation) would allow matchesLoginTenant (maybe just matchesTenant?) to be implemented directly within RoleNameLink? Or maybe clean code doesn't matter any longer now that robots can write all our code?

Comment on lines +8 to +17
const RoleNameLink = ({ role, canRenderLink = true }) => {
return (
<IfPermission perm="ui-authorization-roles.settings.view">
{({ hasPermission }) => (hasPermission && canRenderLink
? <TextLink to={getRoleDetailPath(role.id)} target="_blank">{role.name}</TextLink>
: <>{role.name}</>
)}
</IfPermission>
);
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

target should not be hard-coded here. Make it an optional prop?

Comment thread src/components/EditSections/EditUserRoles/EditUserRoles.js Outdated
@sonarqubecloud

Copy link
Copy Markdown

@JohnC-80
JohnC-80 merged commit 336e74e into master Sep 22, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants