add change_maximum size
Co-Authored-By: xxnitram <xxnitram@users.noreply.github.com>
This commit is contained in:
@ -88,7 +88,8 @@ public class Gruppen2Controller {
|
|||||||
@RequestParam("description") String description,
|
@RequestParam("description") String description,
|
||||||
@RequestParam(value = "visibility", required = false) Boolean visibility,
|
@RequestParam(value = "visibility", required = false) Boolean visibility,
|
||||||
@RequestParam(value = "lecture", required = false) Boolean lecture,
|
@RequestParam(value = "lecture", required = false) Boolean lecture,
|
||||||
@RequestParam("userMaximum") Long userMaximum,
|
@RequestParam(value = "userMaximum", required = false) Long userMaximum,
|
||||||
|
@RequestParam(value = "maxInfiniteUsers", required = false) Boolean maxInfiniteUsers,
|
||||||
@RequestParam(value = "parent", required = false) Long parent,
|
@RequestParam(value = "parent", required = false) Long parent,
|
||||||
@RequestParam(value = "file", required = false) MultipartFile file) throws IOException, EventException {
|
@RequestParam(value = "file", required = false) MultipartFile file) throws IOException, EventException {
|
||||||
|
|
||||||
@ -106,10 +107,11 @@ public class Gruppen2Controller {
|
|||||||
}
|
}
|
||||||
visibility = visibility == null;
|
visibility = visibility == null;
|
||||||
lecture = lecture != null;
|
lecture = lecture != null;
|
||||||
|
maxInfiniteUsers = maxInfiniteUsers != null;
|
||||||
|
|
||||||
if (lecture) parent = null;
|
if (lecture) parent = null;
|
||||||
|
|
||||||
controllerService.createOrga(account, title, description, visibility, lecture, userMaximum, parent, userList);
|
controllerService.createOrga(account, title, description, visibility, lecture, maxInfiniteUsers, userMaximum, parent, userList);
|
||||||
|
|
||||||
return "redirect:/gruppen2/";
|
return "redirect:/gruppen2/";
|
||||||
}
|
}
|
||||||
@ -129,12 +131,14 @@ public class Gruppen2Controller {
|
|||||||
@RequestParam("title") String title,
|
@RequestParam("title") String title,
|
||||||
@RequestParam("description") String description,
|
@RequestParam("description") String description,
|
||||||
@RequestParam(value = "visibility", required = false) Boolean visibility,
|
@RequestParam(value = "visibility", required = false) Boolean visibility,
|
||||||
@RequestParam("userMaximum") Long userMaximum,
|
@RequestParam(value = "userMaximum", required = false) Long userMaximum,
|
||||||
|
@RequestParam(value = "maxInfiniteUsers", required = false) Boolean maxInfiniteUsers,
|
||||||
@RequestParam(value = "parent", required = false) Long parent) throws EventException {
|
@RequestParam(value = "parent", required = false) Long parent) throws EventException {
|
||||||
|
|
||||||
Account account = keyCloakService.createAccountFromPrincipal(token);
|
Account account = keyCloakService.createAccountFromPrincipal(token);
|
||||||
visibility = visibility == null;
|
visibility = visibility == null;
|
||||||
controllerService.createGroup(account, title, description, visibility, userMaximum, parent);
|
maxInfiniteUsers = maxInfiniteUsers != null;
|
||||||
|
controllerService.createGroup(account, title, description, visibility, maxInfiniteUsers, userMaximum, parent);
|
||||||
|
|
||||||
return "redirect:/gruppen2/";
|
return "redirect:/gruppen2/";
|
||||||
}
|
}
|
||||||
@ -309,6 +313,16 @@ public class Gruppen2Controller {
|
|||||||
return "redirect:/gruppen2/details/members/" + groupId;
|
return "redirect:/gruppen2/details/members/" + groupId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator)"})
|
||||||
|
@PostMapping("/details/members/changeMaximum")
|
||||||
|
public String changeMaxSize(@RequestParam("maximum") Long maximum,
|
||||||
|
@RequestParam("group_id") Long groupId,
|
||||||
|
KeycloakAuthenticationToken token){
|
||||||
|
Account account = keyCloakService.createAccountFromPrincipal(token);
|
||||||
|
controllerService.updateMaxUser(account, groupId, maximum);
|
||||||
|
return "redirect:/gruppen2/details/members/" + groupId;
|
||||||
|
}
|
||||||
|
|
||||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator)"})
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator)"})
|
||||||
@PostMapping("/details/members/deleteUser")
|
@PostMapping("/details/members/deleteUser")
|
||||||
public String deleteUser(@RequestParam("group_id") Long groupId,
|
public String deleteUser(@RequestParam("group_id") Long groupId,
|
||||||
|
|||||||
@ -40,7 +40,7 @@ public class ControllerService {
|
|||||||
* @param title Gruppentitel
|
* @param title Gruppentitel
|
||||||
* @param description Gruppenbeschreibung
|
* @param description Gruppenbeschreibung
|
||||||
*/
|
*/
|
||||||
public void createGroup(Account account, String title, String description, Boolean visibility, Long userMaximum, Long parent) throws EventException {
|
public void createGroup(Account account, String title, String description, Boolean visibility, Boolean maxInfiniteUsers, Long userMaximum, Long parent) throws EventException {
|
||||||
Visibility visibility1;
|
Visibility visibility1;
|
||||||
Long groupId = eventService.checkGroup();
|
Long groupId = eventService.checkGroup();
|
||||||
|
|
||||||
@ -51,6 +51,10 @@ public class ControllerService {
|
|||||||
createInviteLink(groupId);
|
createInviteLink(groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(maxInfiniteUsers){
|
||||||
|
userMaximum = 100000L;
|
||||||
|
}
|
||||||
|
|
||||||
CreateGroupEvent createGroupEvent = new CreateGroupEvent(groupId, account.getName(), parent, GroupType.SIMPLE, visibility1, userMaximum);
|
CreateGroupEvent createGroupEvent = new CreateGroupEvent(groupId, account.getName(), parent, GroupType.SIMPLE, visibility1, userMaximum);
|
||||||
eventService.saveEvent(createGroupEvent);
|
eventService.saveEvent(createGroupEvent);
|
||||||
|
|
||||||
@ -60,7 +64,7 @@ public class ControllerService {
|
|||||||
updateRole(account.getName(), groupId);
|
updateRole(account.getName(), groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createOrga(Account account, String title, String description, Boolean visibility, Boolean lecture, Long userMaximum, Long parent, List<User> users) throws EventException {
|
public void createOrga(Account account, String title, String description, Boolean visibility, Boolean lecture, Boolean maxInfiniteUsers, Long userMaximum, Long parent, List<User> users) throws EventException {
|
||||||
Visibility visibility1;
|
Visibility visibility1;
|
||||||
Long groupId = eventService.checkGroup();
|
Long groupId = eventService.checkGroup();
|
||||||
|
|
||||||
@ -77,6 +81,11 @@ public class ControllerService {
|
|||||||
groupType = GroupType.SIMPLE;
|
groupType = GroupType.SIMPLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(maxInfiniteUsers){
|
||||||
|
userMaximum = 100000L;
|
||||||
|
}
|
||||||
|
|
||||||
CreateGroupEvent createGroupEvent = new CreateGroupEvent(groupId, account.getName(), parent, groupType, visibility1, userMaximum);
|
CreateGroupEvent createGroupEvent = new CreateGroupEvent(groupId, account.getName(), parent, groupType, visibility1, userMaximum);
|
||||||
eventService.saveEvent(createGroupEvent);
|
eventService.saveEvent(createGroupEvent);
|
||||||
|
|
||||||
|
|||||||
@ -51,9 +51,14 @@
|
|||||||
<textarea class="form-control" id="description" required
|
<textarea class="form-control" id="description" required
|
||||||
rows="3" th:name="description"></textarea>
|
rows="3" th:name="description"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group mt-3">
|
<div class="custom-control custom-checkbox">
|
||||||
|
<input class="custom-control-input" id="maxInfiniteUsers" th:name="maxInfiniteUsers"
|
||||||
|
type="checkbox">
|
||||||
|
<label class="custom-control-label" for="maxInfiniteUsers">Anzahl unbegrenzt</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group mt-3" id="userMaximum">
|
||||||
<label for="userMaximum">Teilnehmeranzahl</label>
|
<label for="userMaximum">Teilnehmeranzahl</label>
|
||||||
<input class="form-control" id="userMaximum" required th:name="userMaximum"
|
<input class="form-control" th:name="userMaximum"
|
||||||
type="number" min="1" max="10000">
|
type="number" min="1" max="10000">
|
||||||
</div>
|
</div>
|
||||||
<div class="custom-control custom-checkbox">
|
<div class="custom-control custom-checkbox">
|
||||||
@ -111,6 +116,12 @@
|
|||||||
$('#lectureParent').fadeToggle();
|
$('#lectureParent').fadeToggle();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('#maxInfiniteUsers').change(function () {
|
||||||
|
$('#userMaximum').fadeToggle();
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -6,7 +6,11 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Gruppenerstellung</title>
|
<title>Gruppenerstellung</title>
|
||||||
<th:block th:fragment="headcontent">
|
<th:block th:fragment="headcontent">
|
||||||
<!-- Links, Skripts, Styles hier einfügen! -->
|
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
|
||||||
|
rel="stylesheet">
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
|
||||||
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
|
||||||
</th:block>
|
</th:block>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -46,10 +50,15 @@
|
|||||||
<textarea class="form-control" id="description" required
|
<textarea class="form-control" id="description" required
|
||||||
rows="3" th:name="description"></textarea>
|
rows="3" th:name="description"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group mt-3">
|
<div class="custom-control custom-checkbox">
|
||||||
|
<input class="custom-control-input" id="maxInfiniteUsers" th:name="maxInfiniteUsers"
|
||||||
|
type="checkbox">
|
||||||
|
<label class="custom-control-label" for="maxInfiniteUsers">Anzahl unbegrenzt</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group mt-3" id="userMaximum">
|
||||||
<label for="userMaximum">Teilnehmeranzahl</label>
|
<label for="userMaximum">Teilnehmeranzahl</label>
|
||||||
<input class="form-control" id="userMaximum" required th:name="userMaximum"
|
<input class="form-control" th:name="userMaximum"
|
||||||
type="number" min="1">
|
type="number" min="1" max="10000">
|
||||||
</div>
|
</div>
|
||||||
<div class="custom-control custom-checkbox">
|
<div class="custom-control custom-checkbox">
|
||||||
<input class="custom-control-input" id="visibility" th:name="visibility"
|
<input class="custom-control-input" id="visibility" th:name="visibility"
|
||||||
@ -76,6 +85,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('#maxInfiniteUsers').change(function () {
|
||||||
|
$('#userMaximum').fadeToggle();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -70,13 +70,14 @@
|
|||||||
<div class="col-3" style="white-space: nowrap">
|
<div class="col-3" style="white-space: nowrap">
|
||||||
<div style="display: inline-block; margin: 0">
|
<div style="display: inline-block; margin: 0">
|
||||||
<h2>Mitglieder</h2>
|
<h2>Mitglieder</h2>
|
||||||
<div>
|
<div th:switch="${group.getUserMaximum() != 100000}">
|
||||||
<h4>
|
<h4 th:case="${true}">
|
||||||
<a th:text="${group.getMembers().size()}"></a>
|
<a th:text="${group.getMembers().size()}"></a>
|
||||||
<a>von maximal</a>
|
<a>von maximal</a>
|
||||||
<a th:text="${group.getUserMaximum()}"></a>
|
<a th:text="${group.getUserMaximum()}"></a>
|
||||||
<a>Benutzern.</a>
|
<a>Benutzern.</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
<h4 th:case="${false}"> unbegrenzte Teilnehmeranzahl</h4>
|
||||||
</div>
|
</div>
|
||||||
<div th:if="${group.getRoles().get(user.getId()) == admin}">
|
<div th:if="${group.getRoles().get(user.getId()) == admin}">
|
||||||
<form method="get"
|
<form method="get"
|
||||||
|
|||||||
@ -37,13 +37,14 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-10">
|
<div class="col-10">
|
||||||
<h1>Mitglieder bearbeiten</h1>
|
<h1>Mitglieder bearbeiten</h1>
|
||||||
<div>
|
<div th:switch="${group.getUserMaximum() != 100000}">
|
||||||
<h5>
|
<h5 th:case="${true}">
|
||||||
<a th:text="${group.getMembers().size()}"></a>
|
<a th:text="${group.getMembers().size()}"></a>
|
||||||
<a>von maximal</a>
|
<a>von maximal</a>
|
||||||
<a th:text="${group.getUserMaximum()}"></a>
|
<a th:text="${group.getUserMaximum()}"></a>
|
||||||
<a>Benutzern.</a>
|
<a>Benutzern.</a>
|
||||||
</h5>
|
</h5>
|
||||||
|
<h5 th:case="${false}"> unbegrenzte Teilnehmeranzahl</h5>
|
||||||
</div>
|
</div>
|
||||||
<div class="shadow p-2" style="border: 10px solid aliceblue; background: aliceblue">
|
<div class="shadow p-2" style="border: 10px solid aliceblue; background: aliceblue">
|
||||||
<div class="form-group pt-4" th:if="${account.getRoles().contains('orga')}">
|
<div class="form-group pt-4" th:if="${account.getRoles().contains('orga')}">
|
||||||
@ -68,6 +69,24 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group pt-4">
|
||||||
|
<form action="/gruppen2/details/members/changeMaximum" method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-10">
|
||||||
|
<label for="maximum">maximale Teilnehmer ändern</label>
|
||||||
|
<input class="form-control" id="maximum" required th:name="maximum"
|
||||||
|
type="number" th:min="${group.getMembers().size()}" max="10000">
|
||||||
|
</div>
|
||||||
|
<div class="col-2">
|
||||||
|
<button class="btn btn-primary"
|
||||||
|
style="background: #52a1eb; border-style: none"
|
||||||
|
th:name="group_id" th:value="${group.getId()}"
|
||||||
|
type="submit">Erstellen
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
<table class="table" style="table-layout: fixed">
|
<table class="table" style="table-layout: fixed">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -92,7 +111,7 @@
|
|||||||
type="hidden">
|
type="hidden">
|
||||||
<button class="btn btn-warning btn-sm" type="submit" style="margin: 5px">Rolle
|
<button class="btn btn-warning btn-sm" type="submit" style="margin: 5px">Rolle
|
||||||
ändern
|
ändern
|
||||||
</button><!-- th:if -->
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<form action="/gruppen2/details/members/deleteUser" method="post">
|
<form action="/gruppen2/details/members/deleteUser" method="post">
|
||||||
<input th:name="group_id" th:value="${group.getId()}"
|
<input th:name="group_id" th:value="${group.getId()}"
|
||||||
|
|||||||
Reference in New Issue
Block a user