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

STSMACOM-875 Use <IfAnyPermission> and stripes.hasAnyPerm to check for Notes assign/unassign perm. #1538

Merged
merged 7 commits into from
Nov 25, 2024
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
## [9.2.3] IN PROGRESS

* Reset `qindex` once the search field is empty. Fixes STSMACOM-872.
* Use `<IfAnyPermission>` and `stripes.hasAnyPerm` to check for Notes assign/unassign perm. Fixes STSMACOM-875.

## [9.2.0](https://github.com/folio-org/stripes-smart-components/tree/v9.2.0) (2024-10-11)
[Full Changelog](https://github.com/folio-org/stripes-smart-components/compare/v9.1.3...v9.2.0)
Expand Down
7 changes: 4 additions & 3 deletions lib/Notes/NoteViewPage/components/NoteView/NoteView.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import dompurify from 'dompurify';

import {
IfPermission,
IfAnyPermission,
AppIcon,
withStripes,
stripesShape,
Expand Down Expand Up @@ -147,7 +148,7 @@ export default class NoteView extends Component {
} = this.props;


const canAssignUnassign = stripes.hasPerm('ui-notes.item.assign-unassign');
const canAssignUnassign = stripes.hasAnyPerm('ui-notes.item.assign-unassign,ui-notes.item.assign-unassign.execute');
const canDelete = stripes.hasPerm('ui-notes.item.delete');
const canEdit = stripes.hasPerm('ui-notes.item.edit');

Expand All @@ -162,7 +163,7 @@ export default class NoteView extends Component {
<>
{
canUnassign &&
<IfPermission perm="ui-notes.item.assign-unassign">
<IfAnyPermission perm="ui-notes.item.assign-unassign,ui-notes.item.assign-unassign.execute">
<Button
id="note-unassign-button"
buttonStyle="dropdownItem"
Expand All @@ -176,7 +177,7 @@ export default class NoteView extends Component {
<FormattedMessage id="stripes-smart-components.notes.unassign" />
</Icon>
</Button>
</IfPermission>
</IfAnyPermission>
}
<IfPermission perm="ui-notes.item.delete">
<Button
Expand Down
9 changes: 6 additions & 3 deletions lib/Notes/components/NotesAccordion/NotesAccordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
import { get } from 'lodash';

import { IfPermission } from '@folio/stripes-core';
import {
IfPermission,
IfAnyPermission,
} from '@folio/stripes-core';
import {
Accordion,
Headline,
Expand Down Expand Up @@ -71,15 +74,15 @@ export default class NotesAccordion extends Component {
return (
<>
{!hideAssignButton && (
<IfPermission perm="ui-notes.item.assign-unassign">
<IfAnyPermission perm="ui-notes.item.assign-unassign,ui-notes.item.assign-unassign.execute">
<Button
id="note-assign-button"
onClick={this.onAssignButtonClick}
data-test-notes-accordion-assign-button
>
<FormattedMessage id="stripes-smart-components.assignUnassign" />
</Button>
</IfPermission>
</IfAnyPermission>
)}
{
!hideNewButton && (
Expand Down
Loading