fixed exeptionname
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> Co-Authored-By: Talha Caliskan <killerber4t@users.noreply.github.com>
This commit is contained in:
@ -6,7 +6,7 @@ import mops.gruppen2.domain.Role;
|
|||||||
import mops.gruppen2.domain.User;
|
import mops.gruppen2.domain.User;
|
||||||
import mops.gruppen2.domain.exception.EventException;
|
import mops.gruppen2.domain.exception.EventException;
|
||||||
import mops.gruppen2.domain.exception.GroupNotFoundException;
|
import mops.gruppen2.domain.exception.GroupNotFoundException;
|
||||||
import mops.gruppen2.domain.exception.NoAdminAfterActionExeption;
|
import mops.gruppen2.domain.exception.NoAdminAfterActionException;
|
||||||
import mops.gruppen2.security.Account;
|
import mops.gruppen2.security.Account;
|
||||||
import mops.gruppen2.service.ControllerService;
|
import mops.gruppen2.service.ControllerService;
|
||||||
import mops.gruppen2.service.CsvService;
|
import mops.gruppen2.service.CsvService;
|
||||||
@ -234,7 +234,7 @@ public class Gruppen2Controller {
|
|||||||
Account account = keyCloakService.createAccountFromPrincipal(token);
|
Account account = keyCloakService.createAccountFromPrincipal(token);
|
||||||
if (userId.equals(account.getName())) {
|
if (userId.equals(account.getName())) {
|
||||||
if (controllerService.passIfLastAdmin(account, groupId)){
|
if (controllerService.passIfLastAdmin(account, groupId)){
|
||||||
throw new NoAdminAfterActionExeption("Du otto bist letzter Admin");
|
throw new NoAdminAfterActionException("Du otto bist letzter Admin");
|
||||||
}
|
}
|
||||||
controllerService.updateRole(userId, groupId);
|
controllerService.updateRole(userId, groupId);
|
||||||
return "redirect:/gruppen2/details/" + groupId;
|
return "redirect:/gruppen2/details/" + groupId;
|
||||||
|
|||||||
@ -2,9 +2,9 @@ package mops.gruppen2.domain.exception;
|
|||||||
|
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
public class NoAdminAfterActionExeption extends EventException {
|
public class NoAdminAfterActionException extends EventException {
|
||||||
|
|
||||||
public NoAdminAfterActionExeption (String info) {
|
public NoAdminAfterActionException(String info) {
|
||||||
super(HttpStatus.INTERNAL_SERVER_ERROR, "Nach dieser Aktion hätte die Gruppe keinen Admin mehr", info);
|
super(HttpStatus.INTERNAL_SERVER_ERROR, "Nach dieser Aktion hätte die Gruppe keinen Admin mehr", info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -13,12 +13,9 @@ import mops.gruppen2.domain.event.UpdateGroupDescriptionEvent;
|
|||||||
import mops.gruppen2.domain.event.UpdateGroupTitleEvent;
|
import mops.gruppen2.domain.event.UpdateGroupTitleEvent;
|
||||||
import mops.gruppen2.domain.event.UpdateRoleEvent;
|
import mops.gruppen2.domain.event.UpdateRoleEvent;
|
||||||
import mops.gruppen2.domain.exception.EventException;
|
import mops.gruppen2.domain.exception.EventException;
|
||||||
import mops.gruppen2.domain.exception.NoAdminAfterActionExeption;
|
|
||||||
import mops.gruppen2.domain.exception.UserNotFoundException;
|
import mops.gruppen2.domain.exception.UserNotFoundException;
|
||||||
import mops.gruppen2.security.Account;
|
import mops.gruppen2.security.Account;
|
||||||
import org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import springfox.documentation.schema.Entry;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|||||||
Reference in New Issue
Block a user