2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-28 19:46:46 +00:00

consider INVENTREE_RESTRICT_ABOUT setting (#8717)

This commit is contained in:
Matthias Mair 2024-12-18 22:37:39 +01:00 committed by GitHub
parent 6634bc54bd
commit 17fd7f32a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 10 deletions

View File

@ -158,7 +158,10 @@ function DrawerContent({ closeFunc }: Readonly<{ closeFunc?: () => void }>) {
[] []
); );
const menuItemsAbout: MenuLinkItem[] = useMemo(() => AboutLinks(), []); const menuItemsAbout: MenuLinkItem[] = useMemo(
() => AboutLinks(globalSettings, user),
[]
);
return ( return (
<Flex direction='column' mih='100vh' p={16}> <Flex direction='column' mih='100vh' p={16}>

View File

@ -4,6 +4,8 @@ import { openContextModal } from '@mantine/modals';
import type { MenuLinkItem } from '../components/items/MenuLinks'; import type { MenuLinkItem } from '../components/items/MenuLinks';
import { StylishText } from '../components/items/StylishText'; import { StylishText } from '../components/items/StylishText';
import { UserRoles } from '../enums/Roles'; import { UserRoles } from '../enums/Roles';
import type { SettingsStateProps } from '../states/SettingsState';
import type { UserStateProps } from '../states/UserState';
export const navTabs = [ export const navTabs = [
{ text: <Trans>Dashboard</Trans>, name: 'home' }, { text: <Trans>Dashboard</Trans>, name: 'home' },
@ -110,8 +112,11 @@ export function licenseInfo() {
}); });
} }
export function AboutLinks(): MenuLinkItem[] { export function AboutLinks(
return [ settings: SettingsStateProps,
user: UserStateProps
): MenuLinkItem[] {
const base_items: MenuLinkItem[] = [
{ {
id: 'instance', id: 'instance',
title: t`System Information`, title: t`System Information`,
@ -119,13 +124,6 @@ export function AboutLinks(): MenuLinkItem[] {
icon: 'info', icon: 'info',
action: serverInfo action: serverInfo
}, },
{
id: 'about',
title: t`About InvenTree`,
description: t`About the InvenTree Project`,
icon: 'info',
action: aboutInvenTree
},
{ {
id: 'licenses', id: 'licenses',
title: t`License Information`, title: t`License Information`,
@ -134,4 +132,16 @@ export function AboutLinks(): MenuLinkItem[] {
action: licenseInfo 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;
} }