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

UIORGS-388 Protection of viewing and changes of banking information by permissions #583

Merged
merged 2 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -7,6 +7,7 @@
* Implement organization's banking information form. Refs UIORGS-390.
* Implement organization's banking information details view. Refs UIORGS-389.
* Modify summary display in organization view mode. Refs UIORGS-398.
* Protection of viewing and changes of banking information by permissions. Refs UIORGS-388.

## [5.0.0](https://github.com/folio-org/ui-organizations/tree/v5.0.0) (2023-10-12)
[Full Changelog](https://github.com/folio-org/ui-organizations/compare/v4.0.0...v5.0.0)
Expand Down
41 changes: 36 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@
"data-export.config.item.get",
"orders.acquisition-methods.collection.get",
"orders.acquisition-method.item.get",
"organizations.banking-information.collection.get",
"organizations.banking-information.item.get",
"organizations.organizations.collection.get",
"organizations.organizations.item.get",
"organizations-storage.addresses.collection.get",
Expand Down Expand Up @@ -111,7 +109,6 @@
"data-export.config.item.delete",
"data-export.config.item.post",
"data-export.config.item.put",
"organizations.banking-information.item.put",
"organizations.organizations.item.put",
"organizations-storage.addresses.item.put",
"organizations-storage.emails.item.put",
Expand All @@ -131,7 +128,6 @@
"displayName": "Organizations: View, edit, create",
"visible": true,
"subPermissions": [
"organizations.banking-information.item.post",
"organizations.organizations.item.post",
"organizations-storage.addresses.item.post",
"organizations-storage.emails.item.post",
Expand All @@ -145,7 +141,6 @@
"displayName": "Organizations: View, edit, delete",
"visible": true,
"subPermissions": [
"organizations.banking-information.item.delete",
"organizations.organizations.item.delete",
"organizations-storage.addresses.item.delete",
"organizations-storage.emails.item.delete",
Expand All @@ -154,6 +149,42 @@
"ui-organizations.edit"
]
},
{
"permissionName": "ui-organizations.banking-information.view",
"displayName": "Organizations: View banking information",
"visible": true,
"subPermissions": [
"organizations.banking-information.collection.get",
"organizations.banking-information.item.get"
]
},
{
"permissionName": "ui-organizations.banking-information.edit",
"displayName": "Organizations: View and edit banking information",
"visible": true,
"subPermissions": [
"ui-organizations.banking-information.view",
"organizations.banking-information.item.put"
]
},
{
"permissionName": "ui-organizations.banking-information.create",
"displayName": "Organizations: View, edit and create banking information",
"visible": true,
"subPermissions": [
"ui-organizations.banking-information.edit",
"organizations.banking-information.item.post"
]
},
{
"permissionName": "ui-organizations.banking-information.delete",
"displayName": "Organizations: View, edit, create and delete banking information",
"visible": true,
"subPermissions": [
"ui-organizations.banking-information.create",
"organizations.banking-information.item.delete"
]
},
{
"permissionName": "ui-organizations.creds.view",
"displayName": "Organizations: Interface usernames and passwords: view",
Expand Down
14 changes: 8 additions & 6 deletions src/Organizations/OrganizationDetails/OrganizationDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,12 +405,14 @@ const OrganizationDetails = ({
</Accordion>

{isBankingInformationEnabled && (
<Accordion
id={ORGANIZATION_SECTIONS.bankingInformationSection}
label={ORGANIZATION_SECTION_LABELS[ORGANIZATION_SECTIONS.bankingInformationSection]}
>
<OrganizationBankingInfo organization={organization} />
</Accordion>
<IfPermission perm="ui-organizations.banking-information.view">
<Accordion
id={ORGANIZATION_SECTIONS.bankingInformationSection}
label={ORGANIZATION_SECTION_LABELS[ORGANIZATION_SECTIONS.bankingInformationSection]}
>
<OrganizationBankingInfo organization={organization} />
</Accordion>
</IfPermission>
)}
</>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { FieldArray } from 'react-final-form-arrays';
import { FormattedMessage } from 'react-intl';

import { Loading } from '@folio/stripes/components';
import { useStripes } from '@folio/stripes/core';

import {
useBankingAccountTypes,
Expand All @@ -27,6 +28,8 @@ const renderField = (props) => (name, index, fields) => (
);

export const OrganizationBankingInfoForm = () => {
const stripes = useStripes();

const {
bankingAccountTypes,
isFetching: isBankingAccountTypesFetching,
Expand Down Expand Up @@ -54,6 +57,8 @@ export const OrganizationBankingInfoForm = () => {
<FieldArray
addLabel={<FormattedMessage id="ui-organizations.button.bankingInformation.add" />}
component={BankingInformationFieldArray}
canAdd={stripes.hasPerm('ui-organizations.banking-information.create')}
canRemove={stripes.hasPerm('ui-organizations.banking-information.delete')}
id="bankingInformation"
name={BANKING_INFORMATION_FIELD_NAME}
onAdd={createAddNewItem()}
Expand Down
15 changes: 9 additions & 6 deletions src/Organizations/OrganizationForm/OrganizationForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { FormattedMessage } from 'react-intl';
import { useHistory } from 'react-router';
import { mapValues } from 'lodash';

import { IfPermission } from '@folio/stripes/core';
import stripesForm from '@folio/stripes/final-form';
import {
Accordion,
Expand Down Expand Up @@ -223,12 +224,14 @@ const OrganizationForm = ({
</Accordion>

{isBankingInformationEnabled && (
<Accordion
id={ORGANIZATION_SECTIONS.bankingInformationSection}
label={ORGANIZATION_SECTION_LABELS[ORGANIZATION_SECTIONS.bankingInformationSection]}
>
<OrganizationBankingInfoForm />
</Accordion>
<IfPermission perm="ui-organizations.banking-information.edit">
<Accordion
id={ORGANIZATION_SECTIONS.bankingInformationSection}
label={ORGANIZATION_SECTION_LABELS[ORGANIZATION_SECTIONS.bankingInformationSection]}
>
<OrganizationBankingInfoForm />
</Accordion>
</IfPermission>
)}
</>
)
Expand Down
4 changes: 4 additions & 0 deletions translations/ui-organizations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,10 @@
"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.banking-information.view": "Organizations: View banking information",
"permission.banking-information.edit": "Organizations: View and edit banking information",
"permission.banking-information.create": "Organizations: View, edit and create banking information",
"permission.banking-information.delete": "Organizations: View, edit, create and delete banking information",
"permission.settings.view": "Settings (Organizations): View settings",
"permission.settings": "Settings (Organizations): Can view and edit settings"
}
Loading