Skip to content

Commit

Permalink
OM-131: if isWorker, display users as an only entry
Browse files Browse the repository at this point in the history
  • Loading branch information
olewandowski1 committed Feb 29, 2024
1 parent 2d8ad7f commit f4bdfd5
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/components/AdminMainMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,36 @@ 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) {
if (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 f4bdfd5

Please sign in to comment.