diff --git a/docs/docs/concepts/ui/index.md b/docs/docs/concepts/ui/index.md index a38b39c26e..74f814587c 100644 --- a/docs/docs/concepts/ui/index.md +++ b/docs/docs/concepts/ui/index.md @@ -63,7 +63,7 @@ The user menu provides access to the following items: - **Admin Center:** Access to the [admin center](../../settings/admin.md#admin-center) for operational administration - **Database Admin Interface:** Low level administration via the [Database Admin Interface](../../settings/db_admin.md). *Note: Access may be restricted based on user permissions.* - **Change Color Mode:** Toggle between light and dark color modes. -- **About InvenTree:** View version and license information about InvenTree. +- **About InvenTree:** View version and license information about InvenTree. *Note: Only available to staff users.* - **Logout:** Log out of the InvenTree system. ### Page Panels diff --git a/docs/docs/settings/global.md b/docs/docs/settings/global.md index 375fe4db87..d9394387d2 100644 --- a/docs/docs/settings/global.md +++ b/docs/docs/settings/global.md @@ -31,7 +31,6 @@ Configuration of basic server settings: {{ globalsetting("INVENTREE_LINK_PROOF") }} {{ globalsetting("INVENTREE_SHOW_SUPERUSER_BANNER") }} {{ globalsetting("INVENTREE_SHOW_ADMIN_BANNER") }} -{{ globalsetting("INVENTREE_RESTRICT_ABOUT") }} {{ globalsetting("DISPLAY_FULL_NAMES") }} {{ globalsetting("DISPLAY_PROFILE_INFO") }} {{ globalsetting("WEEK_STARTS_ON") }} diff --git a/src/backend/InvenTree/common/setting/system.py b/src/backend/InvenTree/common/setting/system.py index e9bf4bb364..fc0d29c958 100644 --- a/src/backend/InvenTree/common/setting/system.py +++ b/src/backend/InvenTree/common/setting/system.py @@ -216,12 +216,6 @@ SYSTEM_SETTINGS: dict[str, InvenTreeSettingsKeyType] = { 'validator': bool, 'default': False, }, - 'INVENTREE_RESTRICT_ABOUT': { - 'name': _('Restrict showing `about`'), - 'description': _('Show the `about` modal only to superusers'), - 'validator': bool, - 'default': False, - }, 'INVENTREE_SHOW_SUPERUSER_BANNER': { 'name': _('Show superuser banner'), 'description': _('Show a warning banner in the UI when logged in as superuser'), diff --git a/src/backend/InvenTree/common/tests.py b/src/backend/InvenTree/common/tests.py index c743cde786..550d06189c 100644 --- a/src/backend/InvenTree/common/tests.py +++ b/src/backend/InvenTree/common/tests.py @@ -816,7 +816,7 @@ class GlobalSettingsApiTest(InvenTreeAPITestCase): def test_cast(self): """Test that values are cast to the correct type.""" - key = 'INVENTREE_RESTRICT_ABOUT' + key = 'INVENTREE_SHOW_ADMIN_BANNER' # Delete the associated setting object InvenTreeSetting.objects.filter(key=key).delete() diff --git a/src/backend/InvenTree/config_template.yaml b/src/backend/InvenTree/config_template.yaml index e4b9c985ab..e72c853df0 100644 --- a/src/backend/InvenTree/config_template.yaml +++ b/src/backend/InvenTree/config_template.yaml @@ -242,7 +242,7 @@ ldap: # Override global settings #global_settings: # INVENTREE_DEFAULT_CURRENCY: 'CNY' -# INVENTREE_RESTRICT_ABOUT: true +# INVENTREE_SHOW_ADMIN_BANNER: true # Override plugin settings (by plugin slug) # Settings specified here will be locked and cannot be changed via the UI diff --git a/src/frontend/src/components/nav/FirstUseTour.tsx b/src/frontend/src/components/nav/FirstUseTour.tsx index 3b1a6b97ee..2cc1e4921f 100644 --- a/src/frontend/src/components/nav/FirstUseTour.tsx +++ b/src/frontend/src/components/nav/FirstUseTour.tsx @@ -106,15 +106,17 @@ export function FirstUseTour() { title: t`Admin Center`, description: t`The admin center provides access to administrative functions and can be used to manage various functions required for operation of the instance like user management, templates, parameters, plugins.` }); + + // The 'about' menu item is only shown to staff users + _steps.push({ + target: 'tip-ftu-about', + title: t`About InvenTree`, + description: t`Provides information about the InvenTree instance, including version details and relevant links. Important for bug reports.` + }); } - _steps.push({ - target: 'tip-ftu-about', - title: t`About InvenTree`, - description: t`Provides information about the InvenTree instance, including version details and relevant links. Important for bug reports.` - }); return _steps; - }, [userSettings, globalSettings]); + }, [userSettings, globalSettings, user]); const completeTour = () => { setActive(false); diff --git a/src/frontend/src/components/nav/MainMenu.tsx b/src/frontend/src/components/nav/MainMenu.tsx index ad4617046c..6f57a23631 100644 --- a/src/frontend/src/components/nav/MainMenu.tsx +++ b/src/frontend/src/components/nav/MainMenu.tsx @@ -120,13 +120,15 @@ export function MainMenu() { > Change Color Mode - aboutInvenTree()} - leftSection={} - id='tip-ftu-about' - > - About InvenTree - + {user?.is_staff && ( + aboutInvenTree()} + leftSection={} + id='tip-ftu-about' + > + About InvenTree + + )} } diff --git a/src/frontend/src/components/nav/NavigationDrawer.tsx b/src/frontend/src/components/nav/NavigationDrawer.tsx index 6a209d8196..66b7ec6d5f 100644 --- a/src/frontend/src/components/nav/NavigationDrawer.tsx +++ b/src/frontend/src/components/nav/NavigationDrawer.tsx @@ -159,8 +159,8 @@ function DrawerContent({ closeFunc }: Readonly<{ closeFunc?: () => void }>) { }, [user]); const menuItemsAbout: MenuLinkItem[] = useMemo( - () => AboutLinks(globalSettings, user), - [] + () => AboutLinks(user), + [user] ); return ( diff --git a/src/frontend/src/defaults/actions.tsx b/src/frontend/src/defaults/actions.tsx index 90e844e7a6..f50d4fb4dd 100644 --- a/src/frontend/src/defaults/actions.tsx +++ b/src/frontend/src/defaults/actions.tsx @@ -73,13 +73,6 @@ export function getActions(navigate: NavigateFunction) { }, leftSection: }, - { - id: 'about', - label: t`About InvenTree`, - description: t`About the InvenTree org`, - onClick: () => aboutInvenTree(), - leftSection: - }, { id: 'server-info', label: t`Server Information`, @@ -117,6 +110,16 @@ export function getActions(navigate: NavigateFunction) { } ]; + // The 'about' modal requires staff access to the version API endpoint + staff && + _actions.push({ + id: 'about', + label: t`About InvenTree`, + description: t`About the InvenTree org`, + onClick: () => aboutInvenTree(), + leftSection: + }); + staff && _actions.push({ id: 'data-import', diff --git a/src/frontend/src/defaults/links.tsx b/src/frontend/src/defaults/links.tsx index da7a9b614c..794fe32625 100644 --- a/src/frontend/src/defaults/links.tsx +++ b/src/frontend/src/defaults/links.tsx @@ -4,7 +4,6 @@ import { openContextModal } from '@mantine/modals'; import { StylishText } from '@lib/components/StylishText'; import { UserRoles } from '@lib/enums/Roles'; -import type { SettingsStateProps } from '@lib/types/Settings'; import type { UserStateProps } from '@lib/types/User'; import { IconBox, @@ -170,10 +169,7 @@ export function licenseInfo() { }); } -export function AboutLinks( - settings: SettingsStateProps, - user: UserStateProps -): MenuLinkItem[] { +export function AboutLinks(user: UserStateProps): MenuLinkItem[] { const base_items: MenuLinkItem[] = [ { id: 'documentation', @@ -207,8 +203,8 @@ export function AboutLinks( } ]; - // Restrict the about link if that setting is set - if (user.isSuperuser() || !settings.isSet('INVENTREE_RESTRICT_ABOUT')) { + // The 'about' modal requires staff access to the version API endpoint + if (user.isStaff()) { base_items.push({ id: 'about', title: t`About InvenTree`, diff --git a/src/frontend/src/pages/Index/Settings/SystemSettings.tsx b/src/frontend/src/pages/Index/Settings/SystemSettings.tsx index 15a643b96f..5ae02e4827 100644 --- a/src/frontend/src/pages/Index/Settings/SystemSettings.tsx +++ b/src/frontend/src/pages/Index/Settings/SystemSettings.tsx @@ -55,7 +55,6 @@ export default function SystemSettings() { 'INVENTREE_LINK_PROOF', 'INVENTREE_SHOW_SUPERUSER_BANNER', 'INVENTREE_SHOW_ADMIN_BANNER', - 'INVENTREE_RESTRICT_ABOUT', 'INVENTREE_UPLOAD_MAX_SIZE', 'INVENTREE_STRICT_URLS' ]} diff --git a/src/frontend/tests/pui_modals.spec.ts b/src/frontend/tests/pui_modals.spec.ts index e9810e83ad..efdba32337 100644 --- a/src/frontend/tests/pui_modals.spec.ts +++ b/src/frontend/tests/pui_modals.spec.ts @@ -1,4 +1,4 @@ -import { systemKey, test } from './baseFixtures.js'; +import { expect, systemKey, test } from './baseFixtures.js'; import { adminuser } from './defaults.js'; import { doCachedLogin } from './login.js'; import { setPluginState } from './settings.js'; @@ -139,14 +139,19 @@ test('Spotlight - No Keys', async ({ browser }) => { await page.keyboard.press('Escape'); - // use about + // The 'about' action is only available to staff users await page.getByLabel('open-spotlight').click(); await page - .getByRole('button', { name: 'About InvenTree About the InvenTree org' }) - .click(); - await page.getByText('This information is only').waitFor(); - - await page.getByLabel('About InvenTree').getByRole('button').click(); + .getByRole('button', { + name: 'Documentation Visit the documentation to learn more about InvenTree' + }) + .waitFor(); + await expect( + page.getByRole('button', { + name: 'About InvenTree About the InvenTree org' + }) + ).toHaveCount(0); + await page.keyboard.press('Escape'); // use documentation await page.getByLabel('open-spotlight').click();