53 lines
1.6 KiB
HTML
53 lines
1.6 KiB
HTML
<tr id="role-{{ r.id }}">
|
|
<td>{{ r.id }}</td>
|
|
<td>{{ r.name }}</td>
|
|
<td>{{ r.description or "" }}</td>
|
|
<td>
|
|
{% set role_perm_names = r.permissions | map(attribute='name') | list %}
|
|
<table class="perm-matrix">
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
{% for action in actions %}<th>{{ action }}</th>{% endfor %}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for scope in scopes %}
|
|
<tr>
|
|
<td class="perm-scope">{{ scope }}</td>
|
|
{% for action in actions %}
|
|
{% set key = scope ~ ':' ~ action %}
|
|
{% if key in perm_map %}
|
|
<td class="perm-cell">{{ '✓' if key in role_perm_names else '' }}</td>
|
|
{% else %}
|
|
<td class="perm-cell perm-na">—</td>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</td>
|
|
<td>
|
|
{% if r.is_default %}
|
|
<span class="tag">default</span>
|
|
{% else %}
|
|
<button class="btn btn-ghost"
|
|
hx-post="/admin/roles/{{ r.id }}/default"
|
|
hx-target="#role-list"
|
|
hx-swap="outerHTML">Make default</button>
|
|
{% endif %}
|
|
</td>
|
|
<td class="row-actions">
|
|
<button class="btn btn-ghost"
|
|
hx-get="/admin/roles/{{ r.id }}/edit"
|
|
hx-target="#role-{{ r.id }}"
|
|
hx-swap="outerHTML">Edit</button>
|
|
<button class="btn btn-danger"
|
|
hx-delete="/admin/roles/{{ r.id }}"
|
|
hx-target="#role-{{ r.id }}"
|
|
hx-swap="outerHTML"
|
|
hx-confirm="Delete role {{ r.name }}?">Delete</button>
|
|
</td>
|
|
</tr>
|