1

fix entering group youre already part of

This commit is contained in:
killerber4t
2020-03-18 14:11:52 +01:00
parent 19e8ef9c07
commit 56f82203cd
2 changed files with 4 additions and 1 deletions

View File

@ -125,6 +125,9 @@ public class Gruppen2Controller {
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);
User user = new User(account.getName(),account.getGivenname(),account.getFamilyname(),account.getEmail());
Group group = userService.getGroupById(id);
if(group.getMembers().contains(user)) return "errorRenameLater"; //hier soll eigentlich auf die bereits beigetretene Gruppe weitergeleitet werden
controllerService.addUser(account,id);
return "redirect:/gruppen2/";
}

View File

@ -38,7 +38,7 @@
</tr>
</thead>
<tr th:each="member : ${group.getMembers()}">
<th th:value="${member.getUser_id()}"></th>
<th th:text="${member.getUser_id()}"></th>
<th ></th>
<th>
<button class="btn btn-warning">Rolle ändern</button> <!-- th:if -->