vienalatina/apps/board/templates/members.html
Pablo Volenski 1ff3522c56
A superadministrator above the responsable
You asked for a super-admin, and most of it already existed as the `owner` role
— labelled «Responsable», seeded from BOARD_OWNER, already the only account that
could create an admin, demote one, erase anybody or hand the role on, with a
partial unique index making "exactly one" a database rule. You chose a genuine
fifth tier anyway, and there is a reading in which that is the better answer, so
this builds it with that reading made explicit:

  superadministrador — the platform: admin accounts, the look, the identity
  responsable        — the association: members, moderators, invitations

The split is worth more than a rename because of where this is going. Installed
for a second organisation, the superadministrator is whoever maintains the box
and the responsable is their president — so the responsable chair is safe to
hand to a customer, and an admin account is not theirs to grant.

Both chairs are unreachable, for different reasons. The superadministrator
because there is nothing above them. The responsable because the chair belongs
to the association: a platform administrator quietly removing the president of
the organisation they host is exactly the move two chairs exist to prevent.
Each steps down by handing their own chair on, and whoever gives one up becomes
an administrator — there is no role above the one they just gave away.

Migration 7 is the rebuild migration 4 already did, for the same reason (SQLite
cannot alter a CHECK), and it promotes the existing owner — Pablo — to
superadministrator, leaving the responsable chair empty for the association to
fill. Nothing is erased; you offered and it was not needed.

Two things in here would have shipped silently without a test looking for them:

`_seed_superadmin` ends `ON CONFLICT(gitea_login) DO UPDATE SET role = …`. That
line was right while owner was the top of the tree. Left as it was, it would
have matched BOARD_OWNER's login and demoted the superadministrator back to
owner **on every container restart** — a privilege reduction caused by nothing
anybody did, freeing the chair for somebody else. It takes a second start-up to
catch, so the test starts the app three times.

And seven places outside the role modules asked "is this person at least an
admin" as a literal `("owner", "admin")` tuple — the wall's delete, the editor's
page collection, the calendar's edit flag, the dashboard, the moderation
predicate. Every one of them silently excluded the superadministrator the moment
a tier appeared above owner. They are now one ordered LADDER and one
`is_at_least`, so the next tier is a word in a list rather than an audit.

Marca moves from admin-only to superadmin-only, which is the distinction you
asked for: the look and the identity are the platform's.

564 tests pass, including the predicate table per actor and target, each of the
four doors into "make an admin" closed against an admin and against the
responsable, and both single-chair indexes surviving the rebuild.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
2026-10-06 11:55:41 +00:00

75 lines
2.7 KiB
HTML

{% extends "base.html" %}
{% block title %}Miembros{% endblock %}
{% set me = g.member %}
{% set is_admin = me.role in ('owner', 'admin') %}
{% block main %}
<div class="feed-head">
<h1>Miembros</h1>
{% if is_admin %}
<a class="btn" href="{{ url_for('members.new') }}">Dar de alta</a>
{% endif %}
</div>
<p class="muted">
Abre la ficha de alguien para escribirle en privado y leer lo que os habéis
escrito. Los mensajes privados viven en la ficha de cada persona; no hay
bandeja aparte.
</p>
{# Faces and names, and the whole card is the link. This was a page of cards
each carrying a bio, a couple of links and a fold-out admin panel — four
things to read per person, on a page whose job is to let you find one. All of
that is on the person's own page now. #}
<ul class="people">
{% for m in members %}
<li class="person-card {{ '' if m.active else 'person-card--off' }}">
<a class="person-card__link" href="{{ url_for('members.show', login=m.gitea_login) }}">
{% if m.photo_name %}
<img class="person-card__photo"
src="{{ url_for('profiles.member_photo', stored_name=m.photo_name) }}"
alt="" loading="lazy">
{% else %}
{# Their initial rather than a silhouette: a placeholder that is at
least theirs. #}
<span class="person-card__photo person-card__photo--none" aria-hidden="true">
{{ m.display_name[:1]|upper }}
</span>
{% endif %}
<span class="person-card__who">
<span class="person-card__name">
{{ m.display_name }}
{% if m.id == me.id %}<span class="muted small">(tú)</span>{% endif %}
{% if m.unread %}
{# Who wrote, not just that somebody did — and the cards are
sorted so this one is at the top of the page. #}
<span class="tag" aria-label="{{ m.unread }} sin leer">{{ m.unread }}</span>
{% endif %}
</span>
{# The username is shown to everyone: it is not a secret, it is
their address — vienalatina.com/<usuario> — and somebody
looking for a person's page needs to know how it is spelled.
The email stays on their page, inside the admin block. #}
<span class="muted small">
<span class="mono">{{ m.gitea_login }}</span> · {{ labels[m.role] }}
{% if not m.active %} · Suspendido{% endif %}
</span>
</span>
</a>
</li>
{% endfor %}
</ul>
{% if is_admin %}
<p class="muted small">
Hay un solo superadministrador y un solo responsable. El superadministrador
lleva la plataforma: las cuentas de administrador, el aspecto y la identidad
del sitio. El responsable lleva la asociación: los miembros, los moderadores
y las invitaciones. Suspender, cambiar el rol, reenviar la invitación y
eliminar están en la ficha de cada persona, bajo «Gestionar».
</p>
{% endif %}
{% endblock %}