@ -116,6 +116,15 @@ public class Gruppen2Controller {
|
||||
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Group not found");
|
||||
}
|
||||
|
||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator)"})
|
||||
@PostMapping("/detailsBeitreten")
|
||||
public String joinGroup(KeycloakAuthenticationToken token, Model model, @RequestParam(value = "id") Long id) throws EventException {
|
||||
model.addAttribute("account", keyCloakService.createAccountFromPrincipal(token));
|
||||
Account account = keyCloakService.createAccountFromPrincipal (token);
|
||||
controllerService.addUser(account,id);
|
||||
return "redirect:/gruppen2/";
|
||||
}
|
||||
|
||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator)"})
|
||||
@GetMapping("/detailsSearch")
|
||||
public String showGroupDetailsNoMember (KeycloakAuthenticationToken token, Model model, @RequestParam (value="id") Long id) throws EventException {
|
||||
|
||||
@ -29,7 +29,6 @@
|
||||
<div class="row">
|
||||
<div class="col-9">
|
||||
<div class="shadow-sm p-4" style="border: 10px solid aliceblue; background: aliceblue">
|
||||
<form action="/" method="get">
|
||||
<h1 style="color: dodgerblue; font-weight: bold" th:text="${group.getTitle()}"></h1>
|
||||
<p style="font-weight: bold">
|
||||
<span class="badge badge-pill badge-dark" style="background: darkslategray" th:if="${group.getVisibility() == group.getVisibility().PRIVATE }">Private Gruppe</span>
|
||||
@ -39,14 +38,15 @@
|
||||
<p th:text="${group.getDescription()}"></p>
|
||||
<div class="form-group">
|
||||
<div class="text-right">
|
||||
<button class="btn btn-primary" style="border-style: none;">Gruppe beitreten</button>
|
||||
</div>
|
||||
</div>
|
||||
<form method="post" action="/gruppen2/detailsBeitreten">
|
||||
<button type="submit" th:href="@{/gruppen2/detailsBeitreten(id=${group.getId()})}" th:name="id" th:value="${group.id}" class="btn btn-primary" style="border-style: none;">Gruppe beitreten</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user