Skip to content

Commit

Permalink
UIBULKED-545 Clean up permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaSedyx committed Oct 23, 2024
1 parent 2c74c98 commit 6cb1d1f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 25 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
* [UIBULKED-559](https://folio-org.atlassian.net/browse/UIBULKED-559) Update subfield validation in MARC form.
* [UIBULKED-558](https://folio-org.atlassian.net/browse/UIBULKED-558) Add translation for new "Member" column.
* [UIBULKED-556](https://folio-org.atlassian.net/browse/UIBULKED-556) ECS - remove link to affected record in Optimistic error for holdings and items.
* [UIBULKED-545](https://folio-org.atlassian.net/browse/UIBULKED-545) Clean up permissions.

## [4.1.4](https://github.com/folio-org/ui-bulk-edit/tree/v4.1.4) (2024-05-29)

Expand Down
44 changes: 26 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
"subPermissions": []
},
{
"permissionName": "ui-bulk-edit.view.base",
"permissionName": "ui-bulk-edit.base-view.manage",
"displayName": "Bulk Edit: View base permissions",
"replaces": ["ui-bulk-edit.view.base"],
"visible": false,
"subPermissions": [
"module.bulk-edit.enabled",
Expand All @@ -52,11 +53,12 @@
]
},
{
"permissionName": "ui-bulk-edit.edit.base",
"permissionName": "ui-bulk-edit.base-edit.manage",
"displayName": "Bulk Edit: View edit permissions",
"replaces": ["ui-bulk-edit.edit.base"],
"visible": false,
"subPermissions": [
"ui-bulk-edit.view.base",
"ui-bulk-edit.base-view.manage",
"bulk-operations.item.upload.post",
"bulk-operations.item.cancel.post",
"bulk-operations.item.content-update.post",
Expand All @@ -79,41 +81,45 @@
]
},
{
"permissionName": "ui-bulk-edit.view",
"permissionName": "ui-bulk-edit.users.csv.view",
"displayName": "Bulk Edit: Local - View user records",
"replaces": ["ui-bulk-edit.view"],
"visible": true,
"subPermissions": [
"ui-bulk-edit.view.base",
"ui-bulk-edit.edit.base",
"ui-bulk-edit.base-view.manage",
"ui-bulk-edit.base-edit.manage",
"bulk-operations.item.users.get"
]
},
{
"permissionName": "ui-bulk-edit.edit",
"permissionName": "ui-bulk-edit.users.csv.edit",
"displayName": "Bulk Edit: Local - Edit user records",
"replaces": ["ui-bulk-edit.edit"],
"subPermissions": [
"ui-bulk-edit.view",
"ui-bulk-edit.edit.base",
"ui-bulk-edit.users.csv.view",
"ui-bulk-edit.base-edit.manage",
"bulk-operations.item.users.put"
],
"visible": true
},
{
"permissionName": "ui-bulk-edit.app-view",
"permissionName": "ui-bulk-edit.inventory.view",
"displayName": "Bulk Edit: In app - View inventory records",
"replaces": ["ui-bulk-edit.app-view"],
"subPermissions": [
"ui-bulk-edit.view.base",
"ui-bulk-edit.edit.base",
"ui-bulk-edit.base-view.manage",
"ui-bulk-edit.base-edit.manage",
"bulk-operations.item.inventory.get"
],
"visible": true
},
{
"permissionName": "ui-bulk-edit.app-edit",
"permissionName": "ui-bulk-edit.inventory.edit",
"displayName": "Bulk Edit: In app - Edit inventory records",
"replaces": ["ui-bulk-edit.app-edit"],
"subPermissions": [
"ui-bulk-edit.app-view",
"ui-bulk-edit.edit.base",
"ui-bulk-edit.inventory.view",
"ui-bulk-edit.base-edit.manage",
"inventory-storage.item-note-types.collection.get",
"inventory-storage.holdings-note-types.collection.get",
"inventory-storage.electronic-access-relationships.collection.get",
Expand All @@ -122,10 +128,11 @@
"visible": true
},
{
"permissionName": "ui-bulk-edit.app-edit.users",
"permissionName": "ui-bulk-edit.users.edit",
"displayName": "Bulk edit: In app - Edit user records",
"replaces": ["ui-bulk-edit.app-edit.users"],
"subPermissions": [
"ui-bulk-edit.edit.base",
"ui-bulk-edit.base-edit.manage",
"bulk-operations.item.users.get",
"bulk-operations.item.users.put"
],
Expand All @@ -143,8 +150,9 @@
"visible": true
},
{
"permissionName": "ui-bulk-edit.query",
"permissionName": "ui-bulk-edit.query.execute",
"displayName": "Bulk edit: Can build query",
"replaces": ["ui-bulk-edit.query"],
"subPermissions": [
"module.bulk-edit.enabled",
"usergroups.item.get",
Expand Down
2 changes: 1 addition & 1 deletion src/components/PermissionsModal/PermissionsModal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jest.mock('./hooks/useAllPermissions');

const permissions = [
{
'permissionName': 'ui-bulk-edit.app-edit',
'permissionName': 'ui-bulk-edit.inventory.edit',
'displayName': 'Bulk Edit: In app - Edit',
'id': 'baa169b5-e36c-47fd-bbd7-10ad10fb9ce8',
'mutable': false,
Expand Down
14 changes: 8 additions & 6 deletions src/hooks/useBulkPermissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@ export const useBulkPermissions = () => {
const stripes = useStripes();

// CSV perms
const hasCsvViewPerms = stripes.hasPerm('ui-bulk-edit.view');
const hasCsvEditPerms = stripes.hasPerm('ui-bulk-edit.edit');
const hasCsvViewPerms = stripes.hasPerm('ui-bulk-edit.users.csv.view');
const hasCsvEditPerms = stripes.hasPerm('ui-bulk-edit.users.csv.edit');

// In-app perms
const hasInAppViewPerms = stripes.hasPerm('ui-bulk-edit.app-view');
const hasInAppEditPerms = stripes.hasPerm('ui-bulk-edit.app-edit');
const hasInAppUsersEditPerms = stripes.hasPerm('ui-bulk-edit.app-edit.users');
const hasInAppViewPerms = stripes.hasPerm('ui-bulk-edit.inventory.view');
const hasInAppEditPerms = stripes.hasPerm('ui-bulk-edit.inventory.edit');
const hasInAppUsersEditPerms = stripes.hasPerm('uui-bulk-edit.users.edit');

// Query perms
const hasQueryPerms = stripes.hasPerm('ui-bulk-edit.query');
const hasQueryPerms = stripes.hasPerm('ui-bulk-edit.query.execute');

// Inventory
const hasItemsPerms = stripes.hasPerm('ui-inventory.item.edit');
const hasHoldingsPerms = stripes.hasPerm('ui-inventory.holdings.edit');
const hasInstancePerms = stripes.hasPerm('ui-inventory.instance.edit');
const hasInventoryInstanceViewPerms = stripes.hasPerm('ui-inventory.instance.view');

console.log(hasInAppViewPerms, hasInAppEditPerms, hasItemsPerms)

Check warning on line 24 in src/hooks/useBulkPermissions.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Unexpected console statement

Check failure on line 24 in src/hooks/useBulkPermissions.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Missing semicolon

// Quick marc

const hasQuickMarcEditPerms = stripes.hasPerm('ui-quick-marc.quick-marc-editor.all');
Expand Down

0 comments on commit 6cb1d1f

Please sign in to comment.