Skip to content

Commit

Permalink
Merge pull request #95 from openimis/feature/OM-131
Browse files Browse the repository at this point in the history
OM-131: if isWorker, display users as an only entry
  • Loading branch information
malinowskikam authored Mar 1, 2024
2 parents 2d8ad7f + 29ea6f9 commit 2c209b9
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/components/AdminMainMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,34 @@ import {
const ADMIN_MAIN_MENU_CONTRIBUTION_KEY = "admin.MainMenu";

class AdminMainMenu extends Component {
constructor(props) {
super(props);
this.isWorker = props.modulesManager.getConf("fe-core", "isWorker", false);
}

render() {
const { rights } = this.props;
const entries = [];

if (this.isWorker && rights.includes(RIGHT_USERS)) {
entries.push({
text: formatMessage(this.props.intl, "admin", "menu.users"),
icon: <Person />,
route: "/admin/users",
});

if (!entries.length) return null;

return (
<MainMenuContribution
{...this.props}
header={formatMessage(this.props.intl, "admin", "mainMenu")}
icon={<LocationCity />}
entries={entries}
/>
);
}

if (rights.includes(RIGHT_PRODUCTS)) {
entries.push({
text: formatMessage(this.props.intl, "admin", "menu.products"),
Expand Down

0 comments on commit 2c209b9

Please sign in to comment.