Add app home Spaces shell and session diagnostics profile menu

Post-login lands on Spaces empty state instead of a principal dump.
Profile menu exposes Session details with identity, tenant, roles/groups,
and authz diagnostics for operator refinement (CSOC-WP-0004 T01/T07).
This commit is contained in:
tegwick 2026-08-11 02:31:55 +02:00
parent 8169102866
commit 422cd613f6
10 changed files with 404 additions and 88 deletions

View file

@ -20,15 +20,36 @@
color: var(--color-text);
line-height: 1.5;
}
header {
header.app-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 1.5rem;
gap: 1rem;
padding: 0.85rem 1.5rem;
border-bottom: 1px solid #e5e5e5;
}
header a { color: inherit; text-decoration: none; font-weight: 600; }
main { max-width: 48rem; margin: 0 auto; padding: 2.5rem 1.5rem; }
header.app-header a.brand {
color: inherit;
text-decoration: none;
font-weight: 600;
white-space: nowrap;
}
header .nav-main {
display: flex;
align-items: center;
gap: 1rem;
flex: 1;
margin-left: 1.5rem;
}
header .nav-main a {
color: var(--color-muted);
text-decoration: none;
font-weight: 500;
font-size: 0.95rem;
}
header .nav-main a:hover,
header .nav-main a.active { color: var(--color-text); }
header .nav-end { display: flex; align-items: center; gap: 0.75rem; }
.btn {
display: inline-block;
padding: 0.75rem 1.25rem;
@ -42,6 +63,7 @@
cursor: pointer;
}
.btn.secondary { background: #171717; }
.btn.small { padding: 0.4rem 0.85rem; font-size: 0.9rem; }
.muted { color: var(--color-muted); }
.card {
border: 1px solid #e5e5e5;
@ -59,22 +81,88 @@
border: 1px solid #ccc;
border-radius: 6px;
}
dl { display: grid; grid-template-columns: 10rem 1fr; gap: 0.35rem 1rem; }
dl { display: grid; grid-template-columns: 11rem 1fr; gap: 0.35rem 1rem; }
dt { color: var(--color-muted); }
dd { margin: 0; word-break: break-all; }
main { max-width: 48rem; margin: 0 auto; padding: 2.5rem 1.5rem; }
/* Profile menu */
.profile-menu { position: relative; }
.profile-menu > summary {
list-style: none;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 0.4rem;
padding: 0.4rem 0.75rem;
border: 1px solid #e5e5e5;
border-radius: 999px;
font-weight: 600;
font-size: 0.9rem;
user-select: none;
}
.profile-menu > summary::-webkit-details-marker { display: none; }
.profile-menu > summary:hover { border-color: #ccc; }
.profile-menu[open] > summary { border-color: var(--color-primary); }
.profile-menu .menu-panel {
position: absolute;
right: 0;
top: calc(100% + 0.35rem);
min-width: 14rem;
background: #fff;
border: 1px solid #e5e5e5;
border-radius: var(--radius);
box-shadow: 0 8px 24px rgba(0,0,0,0.08);
padding: 0.4rem 0;
z-index: 40;
}
.profile-menu .menu-panel a,
.profile-menu .menu-panel button {
display: block;
width: 100%;
text-align: left;
padding: 0.55rem 1rem;
border: none;
background: none;
font: inherit;
color: inherit;
text-decoration: none;
cursor: pointer;
}
.profile-menu .menu-panel a:hover,
.profile-menu .menu-panel button:hover { background: #f5f5f5; }
.profile-menu .menu-meta {
padding: 0.5rem 1rem 0.35rem;
font-size: 0.8rem;
color: var(--color-muted);
border-bottom: 1px solid #f0f0f0;
margin-bottom: 0.25rem;
}
</style>
{% block extra_head %}{% endblock %}
</head>
<body>
<header>
<a href="{% url 'core:landing' %}">{{ site_name }}</a>
<nav>
{% if user.is_authenticated %}
<a class="btn secondary" href="{% url 'identity:logout' %}">Sign out</a>
{% else %}
<a class="btn" href="{% url 'identity:login' %}">Sign in</a>
{% endif %}
</nav>
<header class="app-header">
<a class="brand" href="{% if user.is_authenticated %}{% url 'core:app_home' %}{% else %}{% url 'core:landing' %}{% endif %}">{{ site_name }}</a>
{% if user.is_authenticated %}
<nav class="nav-main" aria-label="Main">
<a href="{% url 'core:app_home' %}" {% if request.resolver_match.url_name == 'app_home' %}class="active"{% endif %}>Spaces</a>
</nav>
<div class="nav-end">
<details class="profile-menu">
<summary title="Account menu">{{ nav_display_name|default:user.get_username }}</summary>
<div class="menu-panel" role="menu">
<div class="menu-meta">Signed in</div>
<a href="{% url 'core:account_session' %}" role="menuitem">Session details</a>
<a href="{% url 'identity:logout' %}" role="menuitem">Sign out</a>
</div>
</details>
</div>
{% else %}
<div class="nav-end">
<a class="btn small" href="{% url 'identity:login' %}">Sign in</a>
</div>
{% endif %}
</header>
<main>
{% if messages %}

View file

@ -0,0 +1,52 @@
{% extends "base.html" %}
{% block title %}Session details — {{ site_name }}{% endblock %}
{% block content %}
<p class="muted" style="margin:0 0 0.5rem;">
<a href="{% url 'core:app_home' %}">← Spaces</a>
</p>
<h1>Session details</h1>
<p class="muted">
Identity and authorization diagnostics for refining user, group, role,
and tenant management. No secrets are shown.
</p>
<div class="card">
<h2 style="margin-top:0;">Identity</h2>
<dl>
<dt>Display name</dt><dd>{{ principal.display_name }}</dd>
<dt>Username</dt><dd>{{ principal.username }}</dd>
<dt>Email</dt><dd>{{ principal.email|default:"—" }}</dd>
<dt>Issuer</dt><dd>{{ principal.issuer|default:"—" }}</dd>
<dt>Subject</dt><dd>{{ principal.subject|default:"—" }}</dd>
<dt>Principal type</dt><dd>{{ principal.principal_type }}</dd>
</dl>
</div>
<div class="card">
<h2 style="margin-top:0;">Platform user</h2>
<dl>
<dt>user-engine id</dt><dd>{{ principal.user_engine_user_id|default:"—" }}</dd>
<dt>user-engine source</dt><dd>{{ principal.user_engine_source|default:"—" }}</dd>
</dl>
</div>
<div class="card">
<h2 style="margin-top:0;">Tenancy, roles &amp; groups</h2>
<dl>
<dt>Tenant</dt><dd>{{ principal.tenant_id|default:"—" }}</dd>
<dt>Roles</dt><dd>{{ principal.roles_display }}</dd>
<dt>Groups</dt><dd>{{ principal.groups_display }}</dd>
<dt>Assurance</dt><dd>{{ principal.assurance_display }}</dd>
</dl>
</div>
<div class="card">
<h2 style="margin-top:0;">Authorization</h2>
<dl>
<dt>Shell check</dt>
<dd>{% if principal.authz_allow %}allow{% else %}deny{% endif %}</dd>
<dt>Reason</dt><dd>{{ principal.authz_reason }}</dd>
<dt>Decision id</dt><dd>{{ principal.authz_decision_id }}</dd>
</dl>
</div>
{% endblock %}

View file

@ -1,19 +1,28 @@
{% extends "base.html" %}
{% block title %}Home — {{ site_name }}{% endblock %}
{% block title %}Spaces — {{ site_name }}{% endblock %}
{% block content %}
<h1>Signed in</h1>
<p class="muted">Authenticated shell (CSOC-WP-0002). Content surfaces come later.</p>
<div class="card">
<h2 style="margin-top:0;">Principal</h2>
<dl>
<dt>Display name</dt><dd>{{ principal.display_name }}</dd>
<dt>Username</dt><dd>{{ principal.username }}</dd>
<dt>Tenant</dt><dd>{{ principal.tenant_id }}</dd>
<dt>Issuer</dt><dd>{{ principal.issuer }}</dd>
<dt>Subject</dt><dd>{{ principal.subject }}</dd>
<dt>user-engine id</dt><dd>{{ principal.user_engine_user_id }}</dd>
<dt>user-engine source</dt><dd>{{ principal.user_engine_source|default:"—" }}</dd>
<dt>authz</dt><dd>{{ principal.authz_reason }} <span class="muted">({{ principal.authz_decision_id }})</span></dd>
</dl>
</div>
<h1>Spaces</h1>
<p class="muted">
Co-creation spaces for your tenant.
Content will live as markdown in Forgejo-backed repositories.
</p>
{% if spaces %}
<ul class="space-list" style="list-style:none;padding:0;margin:1.5rem 0 0;">
{% for space in spaces %}
<li class="card" style="margin-top:0.75rem;">
<strong>{{ space.title }}</strong>
<span class="muted"> · {{ space.slug }}</span>
</li>
{% endfor %}
</ul>
{% else %}
<div class="card">
<h2 style="margin-top:0;">No spaces yet</h2>
<p class="muted" style="margin-bottom:0;">
Spaces and Forgejo-backed content land in the next steps
(CSOC-WP-0004-T02+). Use the profile menu for session diagnostics.
</p>
</div>
{% endif %}
{% endblock %}