1
0
mirror of https://github.com/pcvolkmer/etl-processor.git synced 2025-04-19 17:26:51 +00:00

feat: add admin role assignment

This commit is contained in:
Paul-Christian Volkmer 2024-03-04 10:12:12 +01:00
parent a008641192
commit 9392bcadc9
3 changed files with 16 additions and 6 deletions

View File

@ -34,7 +34,8 @@ data class UserRole(
enum class Role(val value: String) { enum class Role(val value: String) {
GUEST("guest"), GUEST("guest"),
USER("user") USER("user"),
ADMIN("admin")
} }
interface UserRoleRepository : CrudRepository<UserRole, Long> { interface UserRoleRepository : CrudRepository<UserRole, Long> {

View File

@ -449,7 +449,7 @@ td.clipboard.clipped {
} }
.btn.btn-red:hover, .btn.btn-red:active { .btn.btn-red:hover, .btn.btn-red:active {
background: darkred !important; background: darkred;
} }
.btn.btn-blue { .btn.btn-blue {
@ -458,7 +458,7 @@ td.clipboard.clipped {
} }
.btn.btn-blue:hover, .btn.btn-blue:active { .btn.btn-blue:hover, .btn.btn-blue:active {
background: darkslategray !important; background: darkslategray;
} }
.btn.btn-delete:before { .btn.btn-delete:before {
@ -466,6 +466,14 @@ td.clipboard.clipped {
padding: .2rem; padding: .2rem;
} }
button:disabled,
.btn:disabled {
background: slategray !important;
color: lightgray;
filter: none;
cursor: default;
}
input.inline { input.inline {
border: none; border: none;
font-size: 1.1rem; font-size: 1.1rem;

View File

@ -21,16 +21,17 @@
<td> <td>
<div class="userrole-form"> <div class="userrole-form">
<form th:hx-put="@{/configs/userroles/{id}(id=${userRole.id})}" hx-target="#userroles"> <form th:hx-put="@{/configs/userroles/{id}(id=${userRole.id})}" hx-target="#userroles">
<select name="role"> <select name="role" th:disabled="${#authorization.authentication.getName() == userRole.username}">
<option th:selected="${userRole.role.value == 'guest'}" value="GUEST">Gast</option> <option th:selected="${userRole.role.value == 'guest'}" value="GUEST">Gast</option>
<option th:selected="${userRole.role.value == 'user'}" value="USER">Benutzer</option> <option th:selected="${userRole.role.value == 'user'}" value="USER">Benutzer</option>
<option th:selected="${userRole.role.value == 'admin'}" value="ADMIN">Administrator</option>
</select> </select>
<button class="btn btn-blue">Übernehmen</button> <button class="btn btn-blue" th:disabled="${#authorization.authentication.getName() == userRole.username}">Übernehmen</button>
</form> </form>
</div> </div>
</td> </td>
<td> <td>
<button class="btn btn-red" th:hx-delete="@{/configs/userroles/{id}(id=${userRole.id})}" hx-target="#userroles">Löschen</button> <button class="btn btn-red" th:hx-delete="@{/configs/userroles/{id}(id=${userRole.id})}" hx-target="#userroles" th:disabled="${#authorization.authentication.getName() == userRole.username}">Löschen</button>
</td> </td>
</tr> </tr>
</tbody> </tbody>