diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index bb7de56e99..d0ca4636a0 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -696,6 +696,13 @@ class InvenTreeSetting(BaseInvenTreeSetting): 'default': False, }, + 'INVENTREE_RESTRICT_ABOUT': { + 'name': _('Restrict showing `about`'), + 'description': _('Show the `about` modal only to superusers'), + 'validator': bool, + 'default': False, + }, + 'INVENTREE_COMPANY_NAME': { 'name': _('Company name'), 'description': _('Internal company name'), diff --git a/InvenTree/part/templatetags/inventree_extras.py b/InvenTree/part/templatetags/inventree_extras.py index 0400b54ebd..ad23487a83 100644 --- a/InvenTree/part/templatetags/inventree_extras.py +++ b/InvenTree/part/templatetags/inventree_extras.py @@ -166,6 +166,14 @@ def inventree_demo_mode(*args, **kwargs): return djangosettings.DEMO_MODE +@register.simple_tag() +def inventree_show_about(user, *args, **kwargs): + """ Return True if the about modal should be shown """ + if InvenTreeSetting.get_setting('INVENTREE_RESTRICT_ABOUT') and not user.is_superuser: + return False + return True + + @register.simple_tag() def inventree_docker_mode(*args, **kwargs): """ Return True if the server is running as a Docker image """ diff --git a/InvenTree/templates/InvenTree/settings/global.html b/InvenTree/templates/InvenTree/settings/global.html index 60ae84f001..4d36d59369 100644 --- a/InvenTree/templates/InvenTree/settings/global.html +++ b/InvenTree/templates/InvenTree/settings/global.html @@ -15,6 +15,7 @@ <tbody> {% include "InvenTree/settings/setting.html" with key="INVENTREE_INSTANCE" icon="fa-info-circle" %} {% include "InvenTree/settings/setting.html" with key="INVENTREE_INSTANCE_TITLE" icon="fa-info-circle" %} + {% include "InvenTree/settings/setting.html" with key="INVENTREE_RESTRICT_ABOUT" icon="fa-info-circle" %} {% include "InvenTree/settings/setting.html" with key="INVENTREE_BASE_URL" icon="fa-globe" %} {% include "InvenTree/settings/setting.html" with key="INVENTREE_COMPANY_NAME" icon="fa-building" %} {% include "InvenTree/settings/setting.html" with key="INVENTREE_DOWNLOAD_FROM_URL" icon="fa-cloud-download-alt" %} diff --git a/InvenTree/templates/base.html b/InvenTree/templates/base.html index 0bca5cc0f1..0188ecefa5 100644 --- a/InvenTree/templates/base.html +++ b/InvenTree/templates/base.html @@ -7,6 +7,7 @@ {% settings_value "REPORT_ENABLE" as report_enabled %} {% settings_value "SERVER_RESTART_REQUIRED" as server_restart_required %} {% settings_value "LABEL_ENABLE" with user=user as labels_enabled %} +{% inventree_show_about user as show_about %} {% inventree_demo_mode as demo_mode %} <!DOCTYPE html> @@ -130,7 +131,7 @@ </div> {% include 'modals.html' %} - {% include 'about.html' %} + {% if show_about %}{% include 'about.html' %}{% endif %} {% include "notifications.html" %} {% include "search.html" %} </div> diff --git a/InvenTree/templates/navbar.html b/InvenTree/templates/navbar.html index d687300eb4..3af7fe481f 100644 --- a/InvenTree/templates/navbar.html +++ b/InvenTree/templates/navbar.html @@ -7,6 +7,7 @@ {% settings_value 'STICKY_HEADER' user=request.user as sticky %} {% navigation_enabled as plugin_nav %} {% inventree_demo_mode as demo %} +{% inventree_show_about user as show_about %} <nav class="navbar {% if sticky %}fixed-top{% endif %} navbar-expand-lg navbar-light"> <div class="container-fluid"> @@ -144,6 +145,7 @@ {% trans "System Information" %} </a> </li> + {% if show_about %} <li id='launch-about'> <a class='dropdown-item' href='#'> {% if up_to_date %} @@ -154,6 +156,7 @@ {% trans "About InvenTree" %} </a> </li> + {% endif %} </ul> </li> </ul>