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

Support iface condition in <Settings> entries #1401

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## 9.1.0 IN PROGRESS

* Entries passed into the `<Settings>` component can have an `iface` element specifying an interface that must be present in order for the settings page to be enabled (analogous to the `perm` element).

## [9.0.0](https://github.com/folio-org/stripes-smart-components/tree/v9.0.0) (2023-10-11)
[Full Changelog](https://github.com/folio-org/stripes-smart-components/compare/v8.0.0...v9.0.0)

Expand Down
2 changes: 2 additions & 0 deletions lib/Settings/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class Settings extends Component {
this.sections.forEach(section => {
const sectionRoutes = section.pages
.filter(p => !p.perm || stripes.hasPerm(p.perm))
.filter(p => !p.iface || stripes.hasInterface(p.iface))
zburke marked this conversation as resolved.
Show resolved Hide resolved
.map(page => ({
page,
component: stripes.connect(page.component, { dataKey: page.route }),
Expand Down Expand Up @@ -166,6 +167,7 @@ Settings.propTypes = {
stripes: PropTypes.shape({
connect: PropTypes.func.isRequired,
hasPerm: PropTypes.func.isRequired,
hasInterface: PropTypes.func.isRequired,
}).isRequired,
};

Expand Down
1 change: 1 addition & 0 deletions lib/Settings/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ The following properties are supported:
* `label`: the human-readable label that, when clicked on, links to the specified route.
* `component`: the component that is rendered at the specified route.
* `perm`: if specified, the name of a permission which the current user must have in order to access the page; if the user lacks the permission, then the link is not provided. (If omitted, then no permission check is performed for the sub-page.)
* `iface`: if specified, the name of an interface which the system must implement in order to access the page; if the interface is not present, then the link is not provided. (If omitted, then no interface check is performed for the sub-page.)
* `sections`: an array of section objects. Each member of the list is an object with the following members:
* `label`: the human-readable label that, when clicked on, links to the specified route.
* `pages`: which has the same form as the `pages` prop
Expand Down
Loading