admin change when leaving group
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:
@ -160,16 +160,17 @@ public class ControllerService {
|
||||
addUserList(users, groupId);
|
||||
}
|
||||
|
||||
public void passIfLastAdmin(Account account, Long groupId){
|
||||
public boolean passIfLastAdmin(Account account, Long groupId){
|
||||
Group group = userService.getGroupById(groupId);
|
||||
if (group.getMembers().size() <= 1){
|
||||
throw new NoAdminAfterActionExeption("Du otto bist letzter Admin");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isLastAdmin(account, group)){
|
||||
String newAdminId = getVeteranMember(account, group);
|
||||
updateRole(newAdminId, groupId);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isLastAdmin(Account account, Group group){
|
||||
|
||||
Reference in New Issue
Block a user