added functionality to choose wether group is private or open
This commit is contained in:
@ -79,7 +79,8 @@ public class Gruppen2Controller {
|
||||
@RequestParam(value = "visibility", required = false) Boolean visibility) {
|
||||
|
||||
Account account = keyCloakService.createAccountFromPrincipal(token);
|
||||
controllerService.createGroup(account, title, beschreibung);
|
||||
if (visibility == null) visibility=false;
|
||||
controllerService.createGroup(account, title, beschreibung, visibility);
|
||||
|
||||
return "redirect:/gruppen2/";
|
||||
}
|
||||
|
||||
@ -26,10 +26,15 @@ public class ControllerService {
|
||||
* @param title Gruppentitel
|
||||
* @param description Gruppenbeschreibung
|
||||
*/
|
||||
public void createGroup(Account account, String title, String description) {
|
||||
|
||||
public void createGroup(Account account, String title, String description, Boolean visibility) {
|
||||
Visibility visibility1;
|
||||
if (visibility){
|
||||
visibility1 = Visibility.PUBLIC;
|
||||
}else{
|
||||
visibility1 = Visibility.PRIVATE;
|
||||
}
|
||||
List<Event> eventList = new ArrayList<>();
|
||||
Collections.addAll(eventList, new CreateGroupEvent(eventService.checkGroup(), account.getName(), null , GroupType.LECTURE, Visibility.PUBLIC),
|
||||
Collections.addAll(eventList, new CreateGroupEvent(eventService.checkGroup(), account.getName(), null , GroupType.LECTURE, visibility1),
|
||||
new AddUserEvent(eventService.checkGroup(), account.getName(),account.getGivenname(),account.getFamilyname(),account.getEmail()),
|
||||
new UpdateRoleEvent(eventService.checkGroup(), account.getName(), Role.ADMIN),
|
||||
new UpdateGroupTitleEvent(eventService.checkGroup(), account.getName(), title),
|
||||
|
||||
@ -31,8 +31,9 @@
|
||||
<form action="/" method="get">
|
||||
<h1 style="color: dodgerblue; font-weight: bold" th:text="${group.getTitle()}"></h1>
|
||||
<p style="font-weight: bold">
|
||||
<a th:if="${group.getVisibility() == group.getVisibility().PUBLIC }">Private Gruppe</a>
|
||||
<a th:if="${group.getVisibility() == group.getVisibility().PRIVATE}">Öffentliche Gruppe</a>
|
||||
<span class="badge badge-pill badge-dark" style="background: darkslategray" th:if="${group.getVisibility() == group.getVisibility().PUBLIC }">Private Gruppe</span>
|
||||
<span class="badge badge-pill badge-primary" th:if="${group.getVisibility() == group.getVisibility().PRIVATE}">Öffentliche Gruppe</span>
|
||||
<span class="badge badge-pill badge-success" style="background: lightseagreen" th:if="${group.getType() == group.getType().LECTURE}"> Veranstaltung</span>
|
||||
</p>
|
||||
<p th:text="${group.getDescription()}"></p>
|
||||
<div class="form-group">
|
||||
@ -42,18 +43,21 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<h2 style="display: inline-block">Mitglieder</h2>
|
||||
<a style="float: right" th:if="${role == role.ADMIN}">
|
||||
<button class="btn btn-secondary" type="warning" style="background: slategrey; align-self: end" >Mitglieder bearbeiten</button>
|
||||
</a>
|
||||
<p></p>
|
||||
<ul th:each="member : ${group.getMembers()}" class="list-group-flush" style="background: slategrey">
|
||||
<li class="list-group-item" style="background: aliceblue">
|
||||
<span th:text="${member.getUser_id()}"></span>
|
||||
<span th:if="${role == role.ADMIN}" class="badge badge-success">admin</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="col-3" style="white-space: nowrap">
|
||||
<div>
|
||||
<h2 style="display: inline-block; margin: 0">Mitglieder</h2>
|
||||
<button class="btn btn-secondary" type="warning" style="background: slategrey; float: right" >Mitglieder bearbeiten</button>
|
||||
<p></p>
|
||||
</div>
|
||||
<div>
|
||||
<ul th:each="member : ${group.getMembers()}" class="list-group-flush" style="background: slategrey">
|
||||
<li class="list-group-item" style="background: aliceblue">
|
||||
<span th:text="${member.getUser_id()}"></span>
|
||||
<span th:if="${role == role.ADMIN}" class="badge badge-success">admin</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user