Compare commits

..

10 Commits

6 changed files with 264 additions and 224 deletions
+20 -2
View File
@@ -406,6 +406,9 @@ def _is_inventory_module_path(path):
if not path: if not path:
return False return False
if path == '/' or path.startswith('/home'):
return True
inventory_prefixes = ( inventory_prefixes = (
'/scanner', '/scanner',
'/inventory', '/inventory',
@@ -413,7 +416,10 @@ def _is_inventory_module_path(path):
'/manage_filters', '/manage_filters',
'/manage_locations', '/manage_locations',
'/admin_borrowings', '/admin_borrowings',
'/admin_damaged_items' '/admin_damaged_items',
'/admin/borrowings',
'/admin/damaged_items',
'/terminplan',
) )
return path.startswith(inventory_prefixes) return path.startswith(inventory_prefixes)
@@ -431,11 +437,23 @@ def _enforce_module_access():
def _get_current_module(path): def _get_current_module(path):
"""Resolve the active UI module for navbar separation.""" """Resolve the active UI module for navbar separation."""
if cfg.LIBRARY_MODULE_ENABLED and _is_library_module_path(path): if cfg.LIBRARY_MODULE_ENABLED and _is_library_module_path(path):
session['last_module'] = 'library'
return 'library' return 'library'
if cfg.INVENTORY_MODULE_ENABLED and _is_inventory_module_path(path): if cfg.INVENTORY_MODULE_ENABLED and _is_inventory_module_path(path):
session['last_module'] = 'inventory'
return 'inventory'
last_module = session.get('last_module')
if last_module == 'library' and cfg.LIBRARY_MODULE_ENABLED:
return 'library'
if last_module == 'inventory' and cfg.INVENTORY_MODULE_ENABLED:
return 'inventory'
# Default fallback: prefer inventory if enabled, otherwise library, else inventory
if cfg.INVENTORY_MODULE_ENABLED:
return 'inventory' return 'inventory'
# Default fallback:
return 'library' if cfg.LIBRARY_MODULE_ENABLED else 'inventory' return 'library' if cfg.LIBRARY_MODULE_ENABLED else 'inventory'
Binary file not shown.

After

Width:  |  Height:  |  Size: 273 KiB

+16
View File
@@ -1032,6 +1032,7 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% if 'username' in session %}
{% if CURRENT_MODULE != 'library' and inventory_module_enabled %} {% if CURRENT_MODULE != 'library' and inventory_module_enabled %}
<nav class="navbar navbar-expand-lg navbar-dark" id="inventoryNavbar"> <nav class="navbar navbar-expand-lg navbar-dark" id="inventoryNavbar">
<div class="container-fluid"> <div class="container-fluid">
@@ -1263,6 +1264,21 @@
</div> </div>
</nav> </nav>
{% endif %} {% endif %}
{% else %}
<nav class="navbar navbar-expand-lg navbar-dark" id="loginNavbar">
<div class="container-fluid">
<a class="navbar-brand py-0" href="{{ url_for('home') }}">
<img src="{{ url_for('static', filename='img/invario-logo.png') }}" alt="Invario" height="120" class="d-inline-block align-top" style="filter: drop-shadow(0px 0px 2px rgba(255,255,255,0.5));">
</a>
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="{{ url_for('impressum') }}">Impressum</a>
</li>
</ul>
</div>
</nav>
{% endif %}
<div class="container"> <div class="container">
{% with messages = get_flashed_messages(with_categories=true) %} {% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %} {% if messages %}
+3 -2
View File
@@ -11,7 +11,7 @@
services: services:
# Management Container for multi-tenant scripts # Management Container for multi-tenant scripts
tenant-manager: tenant-manager:
image: docker:cli image: python:3.12-alpine
container_name: tenant-manager container_name: tenant-manager
restart: "no" restart: "no"
profiles: profiles:
@@ -19,7 +19,8 @@ services:
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
- .:/workspace - .:/workspace
entrypoint: ["sh", "-c", "cd /workspace && ./manage-tenant.sh \"$$@\"", "--"] entrypoint: >
sh -c "apk add --no-cache bash docker-cli docker-cli-compose && cd /workspace && ./manage-tenant.sh \"$$@\"" --
redis: redis:
image: redis:7-alpine image: redis:7-alpine
+4
View File
@@ -176,6 +176,10 @@ EOF
restart_app_container() { restart_app_container() {
local env_file="$PWD/.docker-build.env" local env_file="$PWD/.docker-build.env"
local compose_args=( -f "$PWD/docker-compose-multitenant.yml" ) local compose_args=( -f "$PWD/docker-compose-multitenant.yml" )
# Pass along COMPOSE_PROJECT_NAME if set so the internal docker-compose sees it
if [ -n "$COMPOSE_PROJECT_NAME" ]; then
compose_args=( -p "$COMPOSE_PROJECT_NAME" "${compose_args[@]}" )
fi
if [ -f "$PWD/.docker-compose.runtime.override.yml" ]; then if [ -f "$PWD/.docker-compose.runtime.override.yml" ]; then
compose_args+=( -f "$PWD/.docker-compose.runtime.override.yml" ) compose_args+=( -f "$PWD/.docker-compose.runtime.override.yml" )
+2 -1
View File
@@ -1,3 +1,4 @@
#!/bin/bash #!/bin/bash
# Wrapper to run tenant management fully containerized via docker-compose # Wrapper to run tenant management fully containerized via docker-compose
docker compose -f docker-compose-multitenant.yml --profile tools run --rm tenant-manager "$@" PROJECT_NAME=${COMPOSE_PROJECT_NAME:-$(basename "$PWD" | tr '[:upper:]' '[:lower:]')}
docker compose -f docker-compose-multitenant.yml --profile tools run --rm -e COMPOSE_PROJECT_NAME="$PROJECT_NAME" tenant-manager "$@"