Merge branch 'max_userNumber' of https://github.com/hhu-propra2/abschlussprojekt-it-bois into max_userNumber
This commit is contained in:
@ -7,6 +7,7 @@ import mops.gruppen2.domain.Group;
|
||||
import mops.gruppen2.domain.Role;
|
||||
import mops.gruppen2.domain.User;
|
||||
import mops.gruppen2.domain.exception.EventException;
|
||||
import mops.gruppen2.domain.exception.GroupFullException;
|
||||
import mops.gruppen2.domain.exception.UserAlreadyExistsException;
|
||||
|
||||
/**
|
||||
@ -37,7 +38,7 @@ public class AddUserEvent extends Event {
|
||||
}
|
||||
//andere exception
|
||||
if (group.getMembers().size() == group.getUserMaximum()){
|
||||
throw new UserAlreadyExistsException(this.getClass().toString());
|
||||
throw new GroupFullException(this.getClass().toString());
|
||||
}
|
||||
|
||||
group.getMembers().add(user);
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
package mops.gruppen2.domain.exception;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
public class GroupFullException extends EventException {
|
||||
|
||||
public GroupFullException(String info) {
|
||||
super(HttpStatus.INTERNAL_SERVER_ERROR, "Der User existiert bereits.", info);
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,13 +63,18 @@
|
||||
<div class="col-3" style="white-space: nowrap">
|
||||
<div style="display: inline-block; margin: 0">
|
||||
<h2>Mitglieder</h2>
|
||||
<div>
|
||||
<h4>
|
||||
<a th:text="${group.getMembers().size()}"></a>
|
||||
<a>von maximal</a>
|
||||
<a th:text="${group.getUserMaximum()}"></a>
|
||||
<a>Benutzern.</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div th:if="${group.getRoles().get(user.getId()) == admin}">
|
||||
<form method="get"
|
||||
th:action="@{/gruppen2/details/members/{id}(id=${group.getId()})}">
|
||||
<button class="btn btn-secondary"
|
||||
style="background: slategrey; float: right">
|
||||
Mitglieder bearbeiten
|
||||
</button>
|
||||
<button class="btn btn-secondary" style="background: slategrey; float: left">Mitglieder bearbeiten</button>
|
||||
</form>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
Reference in New Issue
Block a user