{% extends "base.html" %}
{% block title %}{{ full_name }} - {{ shell.brand }}{% endblock %}
{% block content %}
<nav class="lat-breadcrumb"><a href="{{ cancel_path }}">← {{ shell.t("Backend Users") }}</a></nav>
<div class="lat-toolbar">
<div class="lat-titleblock">
<p class="lat-eyebrow">{{ shell.t("Backend user") }}</p>
<h1>{{ full_name }}</h1>
</div>
</div>
<div class="lat-card lat-card--form">
<dl class="lat-facts">
<div><dt>{{ shell.t("Username") }}</dt><dd>{{ username }}</dd></div>
<div><dt>{{ shell.t("Email") }}</dt><dd>{{ email }}</dd></div>
<div><dt>{{ shell.t("Status") }}</dt><dd>{% if is_active %}{{ shell.t("Active") }}{% else %}{{ shell.t("Deactivated") }}{% endif %}</dd></div>
</dl>
{# Deactivating is the reversible counterpart to deleting an operator, which
the panel does not offer. Hidden for your own account and without the
permission; the server refuses either way. #}
{% if can_change_state %}
<form method="post" action="{{ state_action }}">
{% include "_csrf.html" %}
<input type="hidden" name="active" value="{% if is_active %}0{% else %}1{% endif %}">
<div class="lat-actions">
{% if is_active %}
<button class="lat-btn lat-btn--danger" type="submit"
data-lat-confirm="{{ shell.t("Deactivate this account? They will be signed out everywhere and cannot sign in until reactivated.") }}">{{ shell.t("Deactivate") }}</button>
{% else %}
<button class="lat-btn lat-btn--secondary" type="submit">{{ shell.t("Reactivate") }}</button>
{% endif %}
</div>
</form>
{% endif %}
{% if is_superuser %}
<div class="lat-alert lat-alert--ok">{{ shell.t("This user is a superuser and holds every permission, so there is nothing to override.") }}</div>
{% else %}
<form method="post" action="{{ action }}">
{% include "_csrf.html" %}
<div class="lat-field">
<span class="lat-field__label">{{ shell.t("Permission overrides") }}</span>
<p class="lat-help">{{ shell.t("Allow or deny a permission for this user regardless of their roles. Inherit defers to the roles. Permissions you do not hold yourself are shown locked.") }}</p>
{% for group in groups %}
<fieldset class="lat-permgroup">
<legend class="lat-permgroup__legend">{{ group.name }}</legend>
{% for perm in group.rows %}
<div class="lat-permrow{% if !perm.changeable %} is-locked{% endif %}">
<span class="lat-permrow__label">{{ perm.label }}</span>
<div class="lat-permrow__states">
<label class="lat-permstate"><input type="radio" name="p:{{ perm.code }}" value="1"{% if perm.state == 1 %} checked{% endif %}{% if !perm.changeable %} disabled{% endif %}> {{ shell.t("Allow") }}</label>
<label class="lat-permstate"><input type="radio" name="p:{{ perm.code }}" value="0"{% if perm.state == 0 %} checked{% endif %}{% if !perm.changeable %} disabled{% endif %}> {{ shell.t("Inherit") }}</label>
<label class="lat-permstate"><input type="radio" name="p:{{ perm.code }}" value="-1"{% if perm.state == -1 %} checked{% endif %}{% if !perm.changeable %} disabled{% endif %}> {{ shell.t("Deny") }}</label>
</div>
</div>
{% endfor %}
</fieldset>
{% endfor %}
</div>
<div class="lat-actions">
<button class="lat-btn lat-btn--primary" type="submit">{{ shell.t("Save") }}</button>
<a class="lat-btn lat-btn--ghost" href="{{ cancel_path }}">{{ shell.t("Cancel") }}</a>
</div>
</form>
{% endif %}
</div>
{% endblock %}