1

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:
Lukas Ettel
2020-03-19 16:10:35 +01:00
parent 06b308167d
commit cf46a549dc
2 changed files with 8 additions and 3 deletions

View File

@ -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){