User -> portal, Admin -> admin

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
Georg Pfuetzenreuter 2022-05-08 04:21:35 +02:00
parent f105d0e1ab
commit cbec25cd6b
Signed by: Georg
GPG Key ID: 1ED2F138E7E6FF57
4 changed files with 30 additions and 29 deletions

View File

@ -36,6 +36,7 @@ public class SecurityConfig extends KeycloakWebSecurityConfigurerAdapter {
http
.authorizeRequests()
.antMatchers("/portal").hasAuthority("devel-user")
.antMatchers("/admin").hasAuthority("devel-admins")
.anyRequest().permitAll();
}
}

View File

@ -45,7 +45,7 @@ public class WebApplication {
}
@GetMapping("/portal")
@GetMapping("/admin")
public String portal(Model model) throws pubshError {
KeycloakAuthenticationToken authentication = (KeycloakAuthenticationToken)
SecurityContextHolder.getContext().getAuthentication();
@ -101,10 +101,10 @@ public class WebApplication {
model.addAttribute("availableOs", availableOs);
//model.addAttribute("osChoice", new String());
return("portal");
return("admin");
}
@GetMapping("/user")
@GetMapping("/portal")
public String user(Model model) throws pubshError {
KeycloakAuthenticationToken authentication = (KeycloakAuthenticationToken)
SecurityContextHolder.getContext().getAuthentication();
@ -146,7 +146,7 @@ public class WebApplication {
model.addAttribute("docker_containers", containers);
model.addAttribute("availableOs", availableOs);
return("user");
return("portal");
}
@DeleteMapping("/frontend/container/delete/{id}")

View File

@ -41,6 +41,9 @@
<button class="btn btn-primary" th:id="request_submission" th:type="submit">Generate</button>
</form>
<h2>Existing containers:</h2>
<table>
<tr th:each="container: ${docker_containers}">
@ -48,15 +51,35 @@
<td th:text="${container.image}" />
<td th:text="${container.id}" />
<td th:text="${container.status}" />
<!-- td><form id="deletion_pseudoform" action="#" th:action="@{'/frontend/container/delete/{id}'(id=${container.id})}" th:method="delete" >
<input type="hidden" name="_method" value="delete" />
<button id="deletion_submission" type="submit">Delete</button>
</form></td-->
<td>
<form id="deletion_pseudoform" action="#" th:action="@{'/frontend/container/delete/{id}'(id=${container.id})}" th:method="delete" th:containerid="${container.id}" th:containerShaSum="${container.imageId}" th:onsubmit="return confirm('Do you really want to delete the container with ID ' + this.getAttribute('containerid') + ' which is attached to the image with checksum ' + this.getAttribute('containerShaSum') + ' ?');">
<!--a
href=""
class="btn btn-danger "
th:data-confirm-delete="|Are you sure you want to delete the container with ID ${container.id}?|"
onclick="if (!confirm(this.getAttribute('data-confirm-delete'))) return false"
>
Delete
</a-->
<button class="btn btn-danger" id="deletion_submission" type="submit">Delete</button>
</form>
</td>
<!-- th:data-confirm-delete="|Are you sure you want to delete this employee ${tempEmployee.firstName}?|"
onclick="if (!confirm(this.getAttribute('data-confirm-delete'))) return false" -->
</tr>
</table>
<!--div id="pagefoot" th:include="layout :: footerFragment">Footer</div-->
<p></p>
<a href="/logout">Logout</a>
</div>
<!-- container -->
</body>
</html>

View File

@ -41,9 +41,6 @@
<button class="btn btn-primary" th:id="request_submission" th:type="submit">Generate</button>
</form>
<h2>Existing containers:</h2>
<table>
<tr th:each="container: ${docker_containers}">
@ -51,35 +48,15 @@
<td th:text="${container.image}" />
<td th:text="${container.id}" />
<td th:text="${container.status}" />
<!-- td><form id="deletion_pseudoform" action="#" th:action="@{'/frontend/container/delete/{id}'(id=${container.id})}" th:method="delete" >
<input type="hidden" name="_method" value="delete" />
<button id="deletion_submission" type="submit">Delete</button>
</form></td-->
<td>
<form id="deletion_pseudoform" action="#" th:action="@{'/frontend/container/delete/{id}'(id=${container.id})}" th:method="delete" th:containerid="${container.id}" th:containerShaSum="${container.imageId}" th:onsubmit="return confirm('Do you really want to delete the container with ID ' + this.getAttribute('containerid') + ' which is attached to the image with checksum ' + this.getAttribute('containerShaSum') + ' ?');">
<!--a
href=""
class="btn btn-danger "
th:data-confirm-delete="|Are you sure you want to delete the container with ID ${container.id}?|"
onclick="if (!confirm(this.getAttribute('data-confirm-delete'))) return false"
>
Delete
</a-->
<button class="btn btn-danger" id="deletion_submission" type="submit">Delete</button>
</form>
</td>
<!-- th:data-confirm-delete="|Are you sure you want to delete this employee ${tempEmployee.firstName}?|"
onclick="if (!confirm(this.getAttribute('data-confirm-delete'))) return false" -->
</tr>
</table>
<!--div id="pagefoot" th:include="layout :: footerFragment">Footer</div-->
<p></p>
<a href="/logout">Logout</a>
</div>
<!-- container -->
</body>
</html>