Repository navigation
Restrict showing edit options for users without sufficient permissions - #109
Open
kurtnordstrom wants to merge 1 commit into
Open
kurtnordstrom wants to merge 1 commit into
kurtnordstrom wants to merge 1 commit into
Conversation
kurtnordstrom
marked this pull request as ready for review
November 13, 2026 20:40
kurtnordstrom
requested review from
JanisSaldabols,
adamdickmeiss,
ihardy,
jakub-id and
skomorokh
as code owners
November 13, 2026 20:40
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Tests do not cover the new component-level read-only behavior or route permission restrictions, leaving control visibility, redirects, tenant-field disabling, and prevention of unauthorized mutations unverified.
2 open issues
What changed in this PR
This PR makes directory editing controls reflect user permissions: consortium admins retain full editing access, institution admins can edit their own entries, and other users receive read-only views.
Changes:
- Adds a shared permission hook and guards entry creation and editing routes.
- Hides restricted actions, makes configuration editors read-only, and disables tenant changes for institution admins.
- Adds permission-hook tests and updates existing test mocks.
| File | Description |
|---|---|
ui-rsdir/src/routes/ViewEntryRoute.js |
Hides the edit action without permission. |
ui-rsdir/src/routes/LMSConfigRoute.js |
Passes permission-based read-only state. |
ui-rsdir/src/routes/ILLConfigRoute.js |
Passes permission-based read-only state. |
ui-rsdir/src/routes/HostProfilesConfigRoutes.test.js |
Adds an authorized-user permission mock. |
ui-rsdir/src/routes/HoldingsPolicyRoute.js |
Passes permission-based read-only state. |
ui-rsdir/src/routes/EditEntryRoute.js |
Redirects unauthorized users and restricts tenant editing. |
ui-rsdir/src/routes/ConfigOverrideSource.test.js |
Adds an authorized-user permission mock. |
ui-rsdir/src/routes/CatalogConfigRoute.js |
Passes permission-based read-only state. |
ui-rsdir/src/hooks/useDirectoryPermissions.test.js |
Tests permission and tenant-ownership rules. |
ui-rsdir/src/hooks/useDirectoryPermissions.js |
Centralizes directory editing permission checks. |
ui-rsdir/src/components/SettingsConfigEditor.js |
Adds component-level read-only rendering. |
ui-rsdir/src/components/EntryTiersEditor.js |
Limits tier membership controls to consortium admins. |
ui-rsdir/src/components/EntryOwnedTiersEditor.js |
Limits owned-tier controls to consortium admins. |
ui-rsdir/src/components/EntryOwnedNetworksEditor.js |
Limits owned-network controls to consortium admins. |
ui-rsdir/src/components/EntryNetworksEditor.js |
Restricts membership and priority editing controls. |
ui-rsdir/src/components/EntryForm.js |
Supports disabling the tenant field. |
ui-rsdir/src/components/EntryClosuresEditor.js |
Limits closure controls to consortium admins. |
ui-rsdir/src/components/Entries.js |
Restricts the new-entry button to consortium admins. |
ui-rsdir/src/components/DirectoryEntryRatio.test.js |
Adds an authorized-user permission mock. |
Review effort: Balanced
|
|
||
| if (field.readOnly && !field.disabled) { | ||
| // Inherited-only setting: show the resolved value without editing controls. | ||
| if ((readOnly || field.readOnly) && !field.disabled) { |
Comment on lines
+113
to
+117
| if (op === CREATE && !isConsortiumAdmin) { | ||
| return <Redirect to={`/directory/entries${location.search}`} />; | ||
| } | ||
| if (op === EDIT && !canEditEntry) { | ||
| return <Redirect to={`/directory/entries/${id}${location.search}`} />; |
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

No description provided.