-
Notifications
You must be signed in to change notification settings - Fork 18
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
UIIN-2452: Enable/disable consortial holdings/item actions based on User permissions #2284
Conversation
…into UIIN-2452
…into UIIN-2452
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.
Agree with @zburke that potentially validateUser
could be used to re-load modules without page reload.
For this though some modifications need to be made to that function, because validateUser
takes tenant
from current session
https://github.com/folio-org/stripes-core/blob/master/src/loginServices.js#L411
If we're going to continue with page reload - please create a tech debt story and add TODO comments where that reload happens to explain why the reload is needed and link the tech debt story
That's true, @BogdanDenis, but that feels like a bug: I expected @NikitaSedyx, can you provide some context for why it was written this way since it seems deliberate? It would be nice to reuse |
SonarCloud Quality Gate failed. 0 Bugs 76.9% Coverage Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
…ser permissions (#2284) * Consortial holdings acc * UIIN-2410: Adjustments * UIIN-2410: Add new hook * UIIN-2410: Add tests * UIIN-2452: Disable buttons when member tenant does not have permissions * UIIN-2410: Instance 3rd pane: Add consortial holdings/item accordion * UIIN-2452: Add unit tests & switching affiliation when view holdings and add item * UIIN-2410: Fix tests * UIIN-2452: Add switching affiliation when click on item barcode & Add holdings button * UIIN-2452: Fix tests * Update HoldingAccordion.js * Update HoldingButtonsGroup.js * UIIN-2452: Fix tests * Update HoldingsListMovement.js * Update HoldingContainer.js * UIIN-2452: Add returning to the previous affiliation * UIIN-2452: Add tenantId to props validation * UIIN-2452: Add behaviour for non-consortial tenant * Fix some comments * Fix perms handling * Fix warnings * Adjust tests * Fix tests * UIIN-2452: Switch user affiliation using validateUser * Update HoldingAccordion.js * Supress Add holding & Add item & View holdings buttons if user doesn't have permissions * UIIN-2452: Fix comments & add unit tests * UIIN-2452: Fixes after review * UIIN-2452: Fix code smells --------- Co-authored-by: Mariia_Aloshyna <[email protected]> Co-authored-by: Mariia Aloshyna <[email protected]> (cherry picked from commit 90f2bff)
Purpose
Approach
tenantId
parameter touseBoundWithHoldings
to dynamically change X-Okapi-Tenant headerViewInstance
component we fetch all the assigned permissions of all user's tenants usinggetUserTenantsPermissions
functiongetCurrentTenantPermissions
function we get all the assigned permissions of all user's tenants ifisUserInConsortiumModed === true
otherwise we get just all user's permissionsisViewHoldingsDisabled
andisAddItemDisabled
props toHoldingButtonsGroup
component to disable "View Holdings" and "Add item" buttons when member tenant doesn't have permissionsisBarcodeAsHotlink
prop toItemBarcode
component to display barcode as a hotlink or not depends on user's permissiondisabled
prop toInstanceNewHolding
component to disable "Add holding" button if user doesn't have permissionsLink
component withButton
and added styles so it behaves as a hotlinkupdateAffiliation
function to switch affiliations if user in on the other member tenant.Refs
UIIN-2452
Screenshots
UIIN-2452.mp4