1

add UserMaximum function

This commit is contained in:
tomvahl
2020-03-19 14:28:15 +01:00
parent 8291b5c41e
commit a2ae464bf0
8 changed files with 23 additions and 13 deletions

View File

@ -131,12 +131,13 @@ public class Gruppen2Controller {
@PostMapping("/createGroup")
public String pCreateGroup(KeycloakAuthenticationToken token,
@RequestParam("title") String title,
@RequestParam("beschreibung") String beschreibung,
@RequestParam(value = "visibility", required = false) Boolean visibility) throws EventException {
@RequestParam("description") String description,
@RequestParam(value = "visibility", required = false) Boolean visibility,
@RequestParam("userMaximum") Long userMaximum) throws EventException {
Account account = keyCloakService.createAccountFromPrincipal(token);
visibility = visibility == null;
controllerService.createGroup(account, title, beschreibung, visibility);
controllerService.createGroup(account, title, description, visibility, userMaximum);
return "redirect:/gruppen2/";
}

View File

@ -20,6 +20,7 @@ public class Group {
private Long id;
private String title;
private String description;
private Long userMaximum;
private GroupType type;
private Visibility visibility;
private Long parent;

View File

@ -15,12 +15,14 @@ public class CreateGroupEvent extends Event {
private Visibility groupVisibility;
private Long groupParent;
private GroupType groupType;
private Long groupUserMaximum;
public CreateGroupEvent(Long groupId, String userId, Long parent, GroupType type, Visibility visibility) {
public CreateGroupEvent(Long groupId, String userId, Long parent, GroupType type, Visibility visibility, Long userMaximum) {
super(groupId, userId);
this.groupParent = parent;
this.groupType = type;
this.groupVisibility = visibility;
this.groupUserMaximum = userMaximum;
}
@Override

View File

@ -43,7 +43,7 @@ public class ControllerService {
* @param title Gruppentitel
* @param description Gruppenbeschreibung
*/
public void createGroup(Account account, String title, String description, Boolean visibility) throws EventException {
public void createGroup(Account account, String title, String description, Boolean visibility, Long userMaximum) throws EventException {
Visibility visibility1;
Long groupId = eventService.checkGroup();
@ -54,7 +54,7 @@ public class ControllerService {
createInviteLink(groupId);
}
CreateGroupEvent createGroupEvent = new CreateGroupEvent(groupId, account.getName(), null, GroupType.SIMPLE, visibility1);
CreateGroupEvent createGroupEvent = new CreateGroupEvent(groupId, account.getName(), null, GroupType.SIMPLE, visibility1, userMaximum);
eventService.saveEvent(createGroupEvent);
addUser(account, groupId);
@ -144,7 +144,7 @@ public class ControllerService {
visibility1 = Visibility.PRIVATE;
}
CreateGroupEvent createGroupEvent = new CreateGroupEvent(groupId, account.getName(), null, GroupType.LECTURE, visibility1);
CreateGroupEvent createGroupEvent = new CreateGroupEvent(groupId, account.getName(), null, GroupType.LECTURE, visibility1, null);
eventService.saveEvent(createGroupEvent);
addUser(account, groupId);