using Kinderstunde klein for date privileges
This commit is contained in:
		| @@ -43,14 +43,14 @@ public abstract class CommonController { | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	@ModelAttribute("hasDiakoneRole") | ||||
| 	public Boolean hasDiakoneRole(Principal principal) { | ||||
| 	@ModelAttribute("hasDateRole") | ||||
| 	public Boolean hasDateRole(Principal principal) { | ||||
| 		OAuth2AuthenticationToken token = (OAuth2AuthenticationToken) principal; | ||||
| 		if (token != null) { | ||||
| 			OAuth2User user = token.getPrincipal(); | ||||
| 			@SuppressWarnings("unchecked") | ||||
| 			List<String> roles = (List<String>) user.getAttributes().get("roles"); | ||||
| 			return roles.contains("Diakone"); | ||||
| 			return roles.contains("Kinderstunde klein"); | ||||
| 		} else { | ||||
| 			LOGGER.warn("token is null, no roles can be detected"); | ||||
| 			return false; | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
| <body> | ||||
| 	<th:block layout:fragment="content"> | ||||
| 		<div class="borderdist"> | ||||
| 			<div class="container" sec:authorize="hasAnyRole('Diakone', 'Bibelunterricht')"> | ||||
| 			<div class="container" sec:authorize="hasAnyRole('Kinderstunde klein', 'Bibelunterricht')"> | ||||
| 				<div class="row"> | ||||
| 					<div class="col-sm-6 col-md-4 col-lg-2 card p-2 m-1" th:each="s : ${list}"> | ||||
| 						<div th:text="${#temporals.format(s.day, 'dd.MM.yyyy')}"></div> | ||||
|   | ||||
| @@ -21,7 +21,7 @@ | ||||
| 			<span class="navbar-toggler-icon"></span> | ||||
| 		</button> | ||||
| 		<div class="collapse navbar-collapse" id="navbarSupportedContent" style="margin-right: 20px"> | ||||
| 			<ul class="navbar-nav mb-2 mb-lg-0" th:if="${hasBUrole || hasDiakoneRole}"> | ||||
| 			<ul class="navbar-nav mb-2 mb-lg-0" th:if="${hasBUrole || hasDateRole}"> | ||||
| 				<li class="nav-item"><a class="btn btn-outline-secondary" th:href="@{/next}" style="margin-left: 12px">Dienstplan</a></li> | ||||
| 				<li class="nav-item"><a class="btn btn-outline-secondary" th:href="@{/sheet}" style="margin-left: 12px" th:if="${hasBUrole}">Einteilung</a></li> | ||||
| 				<li class="nav-item"><a class="btn btn-outline-secondary" th:href="@{/subject/list}" style="margin-left: 12px" th:if="${hasBUrole}">Themen</a></li> | ||||
| @@ -41,8 +41,8 @@ | ||||
| 			</ul> | ||||
| 		</div> | ||||
| 	</nav> | ||||
| 	<div layout:fragment="content" th:if="${hasBUrole || hasDiakoneRole}">content</div> | ||||
| 	<div th:unless="${hasBUrole || hasDiakoneRole}"> | ||||
| 	<div layout:fragment="content" th:if="${hasBUrole || hasDateRole}">content</div> | ||||
| 	<div th:unless="${hasBUrole || hasDateRole}"> | ||||
| 		<div class="borderdist"> | ||||
| 			<div class="alert alert-danger">Leider fehlen Ihnen die Berechtigungen, um diese Anwendung nutzen zu können.</div> | ||||
| 		</div> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user