feat: Implement tenant-aware configuration system

- Added tenant verification checklist in TENANT_VERIFICATION.md for system validation.
- Created tenant_config.py to manage tenant-specific configurations with global defaults and per-tenant overrides.
- Introduced tenant_guards.py for route protection based on module availability.
- Developed tenant_resolver.py for identifying active tenants from requests using subdomains and headers.
- Added tenant_templates.py for Jinja2 template helpers to check module visibility.
- Created error_403.html for custom 403 error handling.
- Defined tenants.json for tenant configurations and module management.
- Implemented unit tests in test_tenant_system.py to ensure functionality of tenant system components.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-24 09:27:46 +02:00
parent 7e93e0a6a9
commit 257cafcb21
16 changed files with 4425 additions and 1 deletions
+113
View File
@@ -0,0 +1,113 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>403 - Zugriff verweigert</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.error-container {
background: white;
border-radius: 10px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
padding: 60px 40px;
max-width: 500px;
text-align: center;
}
.error-code {
font-size: 72px;
font-weight: bold;
color: #667eea;
margin-bottom: 20px;
}
.error-title {
font-size: 28px;
color: #333;
margin-bottom: 15px;
font-weight: 600;
}
.error-message {
font-size: 16px;
color: #666;
margin-bottom: 30px;
line-height: 1.6;
}
.error-details {
background: #f8f9fa;
border-left: 4px solid #667eea;
padding: 15px;
margin-bottom: 30px;
text-align: left;
border-radius: 5px;
font-size: 14px;
color: #555;
}
.back-link {
display: inline-block;
padding: 12px 30px;
background: #667eea;
color: white;
text-decoration: none;
border-radius: 5px;
transition: background 0.3s;
font-weight: 500;
}
.back-link:hover {
background: #764ba2;
}
.tenant-info {
margin-top: 20px;
padding-top: 20px;
border-top: 1px solid #eee;
font-size: 12px;
color: #999;
}
</style>
</head>
<body>
<div class="error-container">
<div class="error-code">403</div>
<div class="error-title">Zugriff verweigert</div>
<div class="error-message">
Diese Ressource ist für Ihre Organisation nicht verfügbar.
</div>
<div class="error-details">
<strong>Grund:</strong> Das angeforderte Modul ist in der Konfiguration Ihrer Organisation nicht aktiviert.
<br><br>
Kontaktieren Sie einen Administrator, wenn Sie glauben, dass dies ein Fehler ist.
</div>
<a href="/" class="back-link">Zur Startseite</a>
{% if tenant_id %}
<div class="tenant-info">
Tenant: {{ tenant_id }}
</div>
{% endif %}
</div>
</body>
</html>