{% 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" style="max-width:680px">
<dl class="lat-facts">
<div><dt>{{ shell.t("Username") }}</dt><dd>{{ username }}</dd></div>
<div><dt>{{ shell.t("Email") }}</dt><dd>{{ email }}</dd></div>
</dl>
{% 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 %}