abfangen von wenn letzter admin nicht mehr
Co-Authored-By: kasch309 <kasch309@users.noreply.github.com> Co-Authored-By: andibuls <andibuls@users.noreply.github.com> Co-Authored-By: xxnitram <xxnitram@users.noreply.github.com>
This commit is contained in:
@ -226,6 +226,14 @@ public class Gruppen2Controller {
|
||||
@PostMapping("/details/members/changeRole")
|
||||
public String changeRole(KeycloakAuthenticationToken token, @RequestParam("group_id") Long groupId,
|
||||
@RequestParam("user_id") String userId) throws EventException {
|
||||
|
||||
|
||||
Account account = keyCloakService.createAccountFromPrincipal(token);
|
||||
if (userId.equals(account.getName())) {
|
||||
controllerService.passIfLastAdmin(account, groupId);
|
||||
controllerService.updateRole(userId, groupId);
|
||||
return "redirect:/gruppen2/details/" + groupId;
|
||||
}
|
||||
controllerService.updateRole(userId, groupId);
|
||||
return "redirect:/gruppen2/details/members/" + groupId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user