Skip to content
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

UIAC-63 Introduce new permission to view all acquisition unit settings #165

Merged
merged 2 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## (5.0.0 IN PROGRESS)
* *BREAKING* Update `react` to `v18`. Refs UIAC-69.
* Introduce new permission to view all acquisition unit settings. Refs UIAC-63.

## [4.0.0](https://github.com/folio-org/ui-acquisition-units/tree/v4.0.0) (2023-02-22)
[Full Changelog](https://github.com/folio-org/ui-acquisition-units/compare/v3.3.1...v4.0.0)
Expand Down
18 changes: 13 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,25 @@
"visible": false
},
{
"permissionName": "ui-acquisition-units.settings.userAssignments",
"displayName": "Settings (acquisition units): Manage acquisition unit user assignments",
"permissionName": "ui-acquisition-units.settings.view",
"displayName": "Settings (acquisition units): View acquisition units",
"subPermissions": [
"settings.acquisition-units.enabled",
"users.collection.get",
"usergroups.collection.get",
"acquisitions-units.units.collection.get",
"acquisitions-units.units.item.get",
"acquisitions-units.memberships.collection.get",
"acquisitions-units.memberships.item.post",
"acquisitions-units.memberships.item.get",
"users.collection.get",
"usergroups.collection.get"
],
"visible": true
},
{
"permissionName": "ui-acquisition-units.settings.userAssignments",
"displayName": "Settings (acquisition units): Manage acquisition unit user assignments",
"subPermissions": [
"ui-acquisition-units.settings.view",
"acquisitions-units.memberships.item.post",
"acquisitions-units.memberships.item.delete"
],
"visible": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ const AcquisitionUnitDetails = ({ acquisitionUnit, close, getEditPath, deleteUni
const stripes = useStripes();

const getActionMenu = () => {
return (
const isPermittedToViewActions = stripes.hasPerm('acquisitions-units.units.item.put') || stripes.hasPerm('acquisitions-units.units.item.delete');

Choose a reason for hiding this comment

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

It's better to utilize UI permissions instead of BE ones in stripes.hasPerm/IfPermission. In this case, the user will not accidentally get access to functionality they shouldn't from another UI permission assigned to them.


return isPermittedToViewActions ? (
<AcquisitionUnitDetailsActions
editUnitPath={getEditPath(acquisitionUnit.id)}
deleteUnit={deleteUnit}
canDelete={canDelete}
/>
);
) : null;
};

const shortcuts = [
Expand Down
Loading