feat: Rolle im User-Profil anzeigen (Topbar-Badge)
Topbar zeigt jetzt: - Username (wie bisher) - "ADMIN"-Badge (teal) wenn user.roles enthaelt 'admin' oder 'gwoe-admin' - Tooltip mit allen Rollen beim Hover Macht sichtbar, ob man Admin-Rechte hat — wichtig fuer Sichtbarkeit von /v2/batch und /v2/admin/* Eintraegen. Plus: Rolle gwoe-admin in Keycloak (Realm collaboration) angelegt + User tobias zugewiesen. Auth-Code prueft realm_access.roles auf 'admin' ODER 'gwoe-admin'. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7c1e0fa0b0
commit
e2dbb796e6
@ -272,10 +272,17 @@
|
||||
|
||||
function renderAuthenticated(container, user) {
|
||||
var name = user.preferred_username || user.name || user.sub || 'Konto';
|
||||
var roles = Array.isArray(user.roles) ? user.roles : [];
|
||||
var isAdmin = roles.indexOf('admin') !== -1 || roles.indexOf('gwoe-admin') !== -1;
|
||||
var rolesTitle = roles.length ? 'Rollen: ' + roles.join(', ') : 'Keine speziellen Rollen';
|
||||
var adminBadge = isAdmin
|
||||
? '<span style="display:inline-block;margin-left:4px;padding:1px 6px;background:rgba(0,157,165,0.2);color:var(--ecg-teal);border-radius:9px;font-size:9px;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;">admin</span>'
|
||||
: '';
|
||||
container.innerHTML =
|
||||
'<span style="' + BTN_BASE + ';cursor:default;gap:4px;">' +
|
||||
'<span style="' + BTN_BASE + ';cursor:default;gap:4px;" title="' + rolesTitle + '">' +
|
||||
'{{ icon("user", 13) | replace("\"", "\'") }} ' +
|
||||
'<span style="max-width:110px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;" title="' + name + '">' + name + '</span>' +
|
||||
'<span style="max-width:110px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + name + '</span>' +
|
||||
adminBadge +
|
||||
'</span>' +
|
||||
' ' +
|
||||
'<button style="' + BTN_BASE + '" onclick="v2AuthLogout()" aria-label="Abmelden">' +
|
||||
|
||||
Loading…
Reference in New Issue
Block a user