mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-27 10:08:44 +00:00
[bug] Fix about dialog restriction (#13379)
- Remove unused INVENTREE_RESTRICT_ABOUT - Adjust first-use tour - Updated docs
This commit is contained in:
1 parent
8e83a8a9a1
commit
03ffbb0902
12 files changed
+47
-47
No files matched your search
@@ -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
|
||||
|
||||
@@ -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") }}
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -120,13 +120,15 @@ export function MainMenu() {
|
||||
>
|
||||
<Trans>Change Color Mode</Trans>
|
||||
</Menu.Item>
|
||||
<Menu.Item
|
||||
onClick={() => aboutInvenTree()}
|
||||
leftSection={<IconInfoCircle />}
|
||||
id='tip-ftu-about'
|
||||
>
|
||||
<Trans>About InvenTree</Trans>
|
||||
</Menu.Item>
|
||||
{user?.is_staff && (
|
||||
<Menu.Item
|
||||
onClick={() => aboutInvenTree()}
|
||||
leftSection={<IconInfoCircle />}
|
||||
id='tip-ftu-about'
|
||||
>
|
||||
<Trans>About InvenTree</Trans>
|
||||
</Menu.Item>
|
||||
)}
|
||||
<Menu.Divider />
|
||||
<Menu.Item
|
||||
leftSection={<IconLogout />}
|
||||
|
||||
@@ -159,8 +159,8 @@ function DrawerContent({ closeFunc }: Readonly<{ closeFunc?: () => void }>) {
|
||||
}, [user]);
|
||||
|
||||
const menuItemsAbout: MenuLinkItem[] = useMemo(
|
||||
() => AboutLinks(globalSettings, user),
|
||||
[]
|
||||
() => AboutLinks(user),
|
||||
[user]
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
@@ -73,13 +73,6 @@ export function getActions(navigate: NavigateFunction) {
|
||||
},
|
||||
leftSection: <IconLink size='1.2rem' />
|
||||
},
|
||||
{
|
||||
id: 'about',
|
||||
label: t`About InvenTree`,
|
||||
description: t`About the InvenTree org`,
|
||||
onClick: () => aboutInvenTree(),
|
||||
leftSection: <IconLink size='1.2rem' />
|
||||
},
|
||||
{
|
||||
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: <IconLink size='1.2rem' />
|
||||
});
|
||||
|
||||
staff &&
|
||||
_actions.push({
|
||||
id: 'data-import',
|
||||
|
||||
@@ -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`,
|
||||
|
||||
@@ -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'
|
||||
]}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user