{% extends "admin/_layout.html" %} {% from "_macros.html" import icon %} {% set section = "users" %} {% block title %}{{ target.name }} - {{ t("Users") }} - {{ brand.name }}{% endblock %} {% block heading %}{{ target.name }}{% endblock %} {% block admin_content %}

{{ icon("chevron-left", "icon--sm") }} {{ t("All users") }} · {{ target.email }}

{% if saved %}
{{ icon("check", "icon--sm") }} {{ saved }}
{% endif %}

{{ t("Account") }}

{{ t("An administrator bypasses every permission and every quota below.") }}

{{ t("Turning this off signs them out everywhere at once, rather than waiting for a cookie to expire.") }}

{# --- What they can actually do -------------------------------------------- #}

{{ t("What this account can do") }}

{{ tm("Read-only, and deliberately: every switch here is set somewhere else — in the baseline or in a named group — and a control on this page would be a third place to change one thing. What it adds is the source, which is the question the grids could not answer without opening every group by eye.") }}

{% for section_name, defs in permission_groups.items() %}
{{ t(section_name) }} {% for definition in defs %} {% set state = explained[definition.key] %}
{{ icon("check" if state.on else "x", "icon--sm") }} {{ t(definition.label) }} {% if state.on %} {# "admin" and "baseline" are codes from `permissions.explain`; a group's name is the group's own. #} {% set source_names = {"admin": t("being an administrator"), "baseline": t("the baseline")} %} {% set parts = [] %} {% for source in state.source %}{% set _ = parts.append(source_names.get(source, source)) %}{% endfor %} {{ t("from %(sources)s", sources=parts | join(", ")) }} {% else %} {{ t("not granted") }} {% endif %}
{% endfor %}
{% endfor %}
{# --- Membership ----------------------------------------------------------- #}

{{ t("Groups") }}

{{ t("Edited from the group's own page. One control per value, so a save here cannot undo a save there.") }}

{% if target.groups %}
{% for group in target.groups %} {{ group.name }} {% endfor %}
{% else %}

{{ t("In no group. They get the baseline and nothing more.") }}

{% endif %}
{# --- Quotas and usage ----------------------------------------------------- #}

{{ t("This month") }}

{{ t("Counted from the first of the month, UTC. Recorded for every reply including one that was stopped or failed — an endpoint charges for tokens it generated whether or not anybody wanted them.") }}

{{ t("Tokens") }}
{{ "{:,}".format(usage.tokens) }} ({{ t("%(prompt)s prompt, %(written)s written", prompt="{:,}".format(usage.prompt_tokens), written="{:,}".format(usage.completion_tokens)) }})
{{ t("Replies") }}
{{ usage.replies }}
{{ t("Images") }}
{{ t("%(month)s this month, %(today)s today", month=usage.images, today=usage.images_today) }} {% if limits.images_per_day %} ({{ t("limit %(n)s a day", n=limits.images_per_day) }}){% endif %}
{% if usage.cost_by_currency %} {# One amount per currency: connections price in their own, and dollars and euros are never added together. #}
{{ t("Cost") }}
{% for code, micro in usage.cost_by_currency.items() %}{{ money(micro, code) }}{% if not loop.last %} · {% endif %}{% endfor %}
{% endif %}

{{ t("Limits in force") }}

{{ tm("Resolved across their groups by maximum — the union rule applied to numbers, so a second group can only ever grant more. Zero means no limit and wins outright, because a group saying “unlimited” must not count for less than one saying “a million”.") }}

{% for key, label, description in limit_defs %}
{{ label }}
{% if limits[key] %}{{ "{:,}".format(limits[key]) }}{% else %}{{ t("no limit") }}{% endif %} {{ description }}
{% endfor %}
{# --- Models --------------------------------------------------------------- #}

{{ t("Models they can use") }}

{{ t("Model access is separate from permissions: a permission says what somebody may do, this says what they may do it with.") }}

{% if models %}
{% for model in models %} {{ model.label }} {% endfor %}
{% else %}

{{ t("None. They cannot start a chat at all.") }}

{% endif %}
{# --- Tokens and devices (here, and only theirs) ------------------- #}

{{ t("Tokens and devices") }}

{{ t("The API tokens this account made and the LLeMbas CLIs it signed in. Each acts as this account, with only its scopes. Revoking one deletes it and signs out whatever holds it at once.") }}

{% if not tokens %}

{{ t("None.") }}

{% else %}
{% for token in tokens %} {% endfor %}
{{ t("Name") }} {{ t("Kind") }} {{ t("Scopes") }} {{ t("Last used") }}
{{ token.name }}
{{ token.prefix }}…
{{ (t("app") if is_app(token) else t("device")) if token.kind == "device" else t("personal") }} {% if token.device_host %}
{{ token.device_host }}{% endif %} {% if token.id in linked %}
{{ t("linked now") }}{% endif %}
{{ token.scopes_json | join(", ") }} {{ token.last_used_at.strftime("%Y-%m-%d %H:%M") if token.last_used_at else t("never") }}
{% endif %}
{# --- Dangerous ------------------------------------------------------------ #}

{{ t("Password and removal") }}

{{ t("Signs them out everywhere. An administrator resetting a password usually means the account is compromised or the person has gone.") }}

{{ t("Their chats and folders go too.") }}

{% endblock %}