Skip to content

Commit

Permalink
UIORGS-346 Introduce new permission to view all organizations' settings
Browse files Browse the repository at this point in the history
  • Loading branch information
usavkov-epam committed Aug 14, 2023
1 parent bb592bd commit d1a1ee6
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Add `Note` field to contact people summary list. Refs UIORGS-352.
* Organizations filters consistency in `ui-organizations` and `ui-plugin-find-organization` . Refs UIORGS-373.
* No pop-up message when creating or editing an organization. Refs UIORGS-375.
* Introduce new permission to view all organizations' settings. Refs UIORGS-346.

## [4.0.0](https://github.com/folio-org/ui-organizations/tree/v4.0.0) (2023-02-22)
[Full Changelog](https://github.com/folio-org/ui-organizations/compare/v3.3.1...v4.0.0)
Expand Down
14 changes: 11 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,25 @@
]
},
{
"permissionName": "ui-organizations.settings",
"displayName": "Settings (Organizations): Can view and edit settings",
"permissionName": "ui-organizations.settings.view",
"displayName": "Settings (Organizations): View settings",
"visible": true,
"subPermissions": [
"settings.organizations.enabled",
"organizations-storage.organization-types.collection.get",
"organizations-storage.organization-types.item.get",
"organizations-storage.categories.collection.get"
]
},
{
"permissionName": "ui-organizations.settings",
"displayName": "Settings (Organizations): Can view and edit settings",
"visible": true,
"subPermissions": [
"ui-organizations.settings.view",
"organizations-storage.organization-types.item.post",
"organizations-storage.organization-types.item.put",
"organizations-storage.organization-types.item.delete",
"organizations-storage.categories.collection.get",
"organizations-storage.categories.item.delete",
"organizations-storage.categories.item.post",
"organizations-storage.categories.item.put"
Expand Down
15 changes: 7 additions & 8 deletions src/Settings/CategorySettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ class CategorySettings extends Component {
value: <FormattedMessage id="ui-organizations.settings.name" />,
action: <FormattedMessage id="ui-organizations.settings.action" />,
};
const getDisableAttr = () => ({
disabled: !stripes.hasPerm('ui-organizations.settings'),
});
const actionProps = {
create: getDisableAttr,
edit: getDisableAttr,
delete: getDisableAttr,

const hasEditPerms = stripes.hasPerm('ui-organizations.settings');
const actionSuppressor = {
edit: () => !hasEditPerms,
delete: () => !hasEditPerms,
};

return (
<this.connectedControlledVocab
actionSuppressor={actionSuppressor}
canCreate={hasEditPerms}
stripes={stripes}
baseUrl="organizations-storage/categories"
records="categories"
Expand All @@ -40,7 +40,6 @@ class CategorySettings extends Component {
nameKey="categories"
id="categories"
sortby="value"
actionProps={actionProps}
/>
);
}
Expand Down
15 changes: 6 additions & 9 deletions src/Settings/TypeSettings/TypeSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,10 @@ class TypeSettings extends Component {
action: <FormattedMessage id="ui-organizations.settings.action" />,
};

const getDisableAttr = () => ({
disabled: !stripes.hasPerm('ui-organizations.settings'),
});

const actionProps = {
create: getDisableAttr,
edit: getDisableAttr,
delete: getDisableAttr,
const hasEditPerms = stripes.hasPerm('ui-organizations.settings');
const actionSuppressor = {
edit: () => !hasEditPerms,
delete: () => !hasEditPerms,
};

const fieldComponents = {
Expand All @@ -68,7 +64,8 @@ class TypeSettings extends Component {

return (
<this.connectedControlledVocab
actionProps={actionProps}
actionSuppressor={actionSuppressor}
canCreate={hasEditPerms}
baseUrl="organizations-storage/organization-types"
columnMapping={columnMapping}
fieldComponents={fieldComponents}
Expand Down
1 change: 1 addition & 0 deletions translations/ui-organizations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -449,5 +449,6 @@
"permission.creds.manage": "Organizations: Interface usernames and passwords: view, edit, create, delete",
"permission.acqUnits.assign": "Organizations: Assign acquisition units to new organization",
"permission.acqUnits.manage": "Organizations: Manage acquisition units",
"permission.settings.view": "Settings (Organizations): View settings",
"permission.settings": "Settings (Organizations): Can view and edit settings"
}

0 comments on commit d1a1ee6

Please sign in to comment.