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