mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 11:36:44 +00:00
consider INVENTREE_RESTRICT_ABOUT setting (#8717)
This commit is contained in:
parent
6634bc54bd
commit
17fd7f32a4
@ -158,7 +158,10 @@ function DrawerContent({ closeFunc }: Readonly<{ closeFunc?: () => void }>) {
|
||||
[]
|
||||
);
|
||||
|
||||
const menuItemsAbout: MenuLinkItem[] = useMemo(() => AboutLinks(), []);
|
||||
const menuItemsAbout: MenuLinkItem[] = useMemo(
|
||||
() => AboutLinks(globalSettings, user),
|
||||
[]
|
||||
);
|
||||
|
||||
return (
|
||||
<Flex direction='column' mih='100vh' p={16}>
|
||||
|
@ -4,6 +4,8 @@ import { openContextModal } from '@mantine/modals';
|
||||
import type { MenuLinkItem } from '../components/items/MenuLinks';
|
||||
import { StylishText } from '../components/items/StylishText';
|
||||
import { UserRoles } from '../enums/Roles';
|
||||
import type { SettingsStateProps } from '../states/SettingsState';
|
||||
import type { UserStateProps } from '../states/UserState';
|
||||
|
||||
export const navTabs = [
|
||||
{ text: <Trans>Dashboard</Trans>, name: 'home' },
|
||||
@ -110,8 +112,11 @@ export function licenseInfo() {
|
||||
});
|
||||
}
|
||||
|
||||
export function AboutLinks(): MenuLinkItem[] {
|
||||
return [
|
||||
export function AboutLinks(
|
||||
settings: SettingsStateProps,
|
||||
user: UserStateProps
|
||||
): MenuLinkItem[] {
|
||||
const base_items: MenuLinkItem[] = [
|
||||
{
|
||||
id: 'instance',
|
||||
title: t`System Information`,
|
||||
@ -119,13 +124,6 @@ export function AboutLinks(): MenuLinkItem[] {
|
||||
icon: 'info',
|
||||
action: serverInfo
|
||||
},
|
||||
{
|
||||
id: 'about',
|
||||
title: t`About InvenTree`,
|
||||
description: t`About the InvenTree Project`,
|
||||
icon: 'info',
|
||||
action: aboutInvenTree
|
||||
},
|
||||
{
|
||||
id: 'licenses',
|
||||
title: t`License Information`,
|
||||
@ -134,4 +132,16 @@ export function AboutLinks(): MenuLinkItem[] {
|
||||
action: licenseInfo
|
||||
}
|
||||
];
|
||||
|
||||
// Restrict the about link if that setting is set
|
||||
if (user.isSuperuser() || !settings.isSet('INVENTREE_RESTRICT_ABOUT')) {
|
||||
base_items.push({
|
||||
id: 'about',
|
||||
title: t`About InvenTree`,
|
||||
description: t`About the InvenTree Project`,
|
||||
icon: 'info',
|
||||
action: aboutInvenTree
|
||||
});
|
||||
}
|
||||
return base_items;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user