summaryrefslogtreecommitdiff
path: root/src/main/resources/templates/configs/userroles.html
blob: 23cc5f25450e1478a0bca011703966fab7cae924 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<div th:if="${not userRolesEnabled}">
    <h2><span>⛔</span> Benutzerberechtigungen</h2>
    <p>Die Verwendung von rollenbasierten Benutzerberechtigungen ist nicht aktiviert.</p>
</div>

<div id="userroles" th:if="${userRolesEnabled}">
    <h2><span>✅</span> Benutzerberechtigungen</h2>
    <div class="border">
        <div th:if="${userRoles.isEmpty()}">Noch keine Benutzerberechtigungen vorhanden.</div>
        <table th:if="${not userRoles.isEmpty()}">
            <thead>
                <tr>
                    <th>Benutzername</th>
                    <th>Rolle</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                <tr th:each="userRole : ${userRoles}">
                    <td>[[ ${userRole.username} ]]</td>
                    <td>
                        <div class="userrole-form">
                            <form th:hx-put="@{/configs/userroles/{id}(id=${userRole.id})}" hx-target="#userroles">
                                <select name="role">
                                    <option th:selected="${userRole.role.value == 'guest'}" value="GUEST">Gast</option>
                                    <option th:selected="${userRole.role.value == 'user'}" value="USER">Benutzer</option>
                                </select>
                                <button class="btn btn-blue">Übernehmen</button>
                            </form>
                        </div>
                    </td>
                    <td>
                        <button class="btn btn-red" th:hx-delete="@{/configs/userroles/{id}(id=${userRole.id})}" hx-target="#userroles">Löschen</button>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>