Administrator Views verbessert

This commit is contained in:
concierge committed 2026-10-25 11:11:37 +01:00
1 parent ffdb399f9e
commit 0a2070fcf5
12 files changed
+247 -12

No files matched your search

+7
View File
@@ -8,6 +8,13 @@ from cmbnet.db import get_db
admin_accounts_bp = Blueprint('admin', __name__)
@admin_accounts_bp.route('/dashboard')
@role_required('Administrator')
def dashboard(**kwargs):
"""Admin Dashboard"""
return render_template('admin/dashboard.html')
@admin_accounts_bp.route('/accounts')
@role_required('Administrator')
def accounts(**kwargs):
+32
View File
@@ -370,6 +370,38 @@ def import_streets(**kwargs):
return jsonify({'success': True, 'count': count})
@admin_api_bp.route('/broker/status')
@role_required('Administrator')
def broker_status(**kwargs):
"""Status aktiver WebSocket-Verbindungen"""
connections = broker.connections.get(g.tenant_id, {}) if hasattr(broker, 'connections') else {}
result = []
for account_id, conn in connections.items():
account = db = get_db().execute(
'SELECT id, name, role FROM accounts WHERE id = ? AND tenant_id = ?',
(account_id, g.tenant_id)
).fetchone()
if not account:
continue
entry = {
'account_id': account['id'],
'account_name': account['name'],
'role': account['role'],
'group_id': None,
'group_alias': None
}
if account['role'] == 'Gruppe':
group = get_db().execute(
'SELECT id, aliasname FROM groups WHERE account_id = ? AND tenant_id = ?',
(account['id'], g.tenant_id)
).fetchone()
if group:
entry['group_id'] = group['id']
entry['group_alias'] = group['aliasname']
result.append(entry)
return jsonify({'connections': result})
@admin_api_bp.route('/hausnummern/import', methods=['POST'])
@role_required('Administrator')
def import_house_numbers(**kwargs):
+1 -1
View File
@@ -55,7 +55,7 @@ def login(**kwargs):
# Rollenbasierte Weiterleitung
role = account['role']
if role == 'Administrator':
return redirect(url_for('admin.accounts', tenant=tenant_selected))
return redirect(url_for('admin.dashboard', tenant=tenant_selected))
elif role == 'Dispatcher':
return redirect(url_for('views.dispatcher', tenant=tenant_selected))
elif role == 'Beobachter':
+1 -1
View File
@@ -15,7 +15,7 @@ def index(**kwargs):
tenant = g.tenant_code
if role == 'Administrator':
return redirect(url_for('admin.accounts', tenant=tenant))
return redirect(url_for('admin.dashboard', tenant=tenant))
elif role == 'Dispatcher':
return redirect(url_for('views.dispatcher', tenant=tenant))
elif role == 'Beobachter':