Merge remote-tracking branch 'origin/master' into import-csv-in-overview
# Conflicts: # src/main/java/mops/gruppen2/controller/Gruppen2Controller.java # src/main/java/mops/gruppen2/service/ControllerService.java # src/main/resources/templates/editMembers.html
This commit is contained in:
@ -3,7 +3,6 @@ package mops.gruppen2.controller;
|
|||||||
import mops.gruppen2.config.Gruppen2Config;
|
import mops.gruppen2.config.Gruppen2Config;
|
||||||
import mops.gruppen2.domain.Exceptions.EventException;
|
import mops.gruppen2.domain.Exceptions.EventException;
|
||||||
import mops.gruppen2.domain.Group;
|
import mops.gruppen2.domain.Group;
|
||||||
|
|
||||||
import mops.gruppen2.domain.Role;
|
import mops.gruppen2.domain.Role;
|
||||||
import mops.gruppen2.domain.User;
|
import mops.gruppen2.domain.User;
|
||||||
import mops.gruppen2.domain.Visibility;
|
import mops.gruppen2.domain.Visibility;
|
||||||
@ -118,9 +117,10 @@ public class Gruppen2Controller {
|
|||||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator"})
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator"})
|
||||||
@GetMapping("/findGroup")
|
@GetMapping("/findGroup")
|
||||||
public String findGroup(KeycloakAuthenticationToken token, Model model, @RequestParam(value = "suchbegriff", required = false) String suchbegriff) throws EventException {
|
public String findGroup(KeycloakAuthenticationToken token, Model model, @RequestParam(value = "suchbegriff", required = false) String suchbegriff) throws EventException {
|
||||||
|
Account account = keyCloakService.createAccountFromPrincipal(token);
|
||||||
List<Group> groupse = new ArrayList<>();
|
List<Group> groupse = new ArrayList<>();
|
||||||
if (suchbegriff != null) {
|
if (suchbegriff != null) {
|
||||||
groupse = groupService.findGroupWith(suchbegriff);
|
groupse = groupService.findGroupWith(suchbegriff,account);
|
||||||
}
|
}
|
||||||
model.addAttribute("account", keyCloakService.createAccountFromPrincipal(token));
|
model.addAttribute("account", keyCloakService.createAccountFromPrincipal(token));
|
||||||
model.addAttribute("gruppen", groupse);
|
model.addAttribute("gruppen", groupse);
|
||||||
@ -141,9 +141,10 @@ public class Gruppen2Controller {
|
|||||||
return "redirect:/gruppen2/";
|
return "redirect:/gruppen2/";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator"})
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator)"})
|
||||||
@GetMapping("/details")
|
@GetMapping("/details/{id}")
|
||||||
public String showGroupDetails(KeycloakAuthenticationToken token, Model model, @RequestParam(value = "id") Long id) throws EventException, ResponseStatusException {
|
public String showGroupDetails(KeycloakAuthenticationToken token, Model model, @PathVariable (value="id") Long id) throws EventException, ResponseStatusException {
|
||||||
|
|
||||||
model.addAttribute("account", keyCloakService.createAccountFromPrincipal(token));
|
model.addAttribute("account", keyCloakService.createAccountFromPrincipal(token));
|
||||||
Group group = userService.getGroupById(id);
|
Group group = userService.getGroupById(id);
|
||||||
Account account = keyCloakService.createAccountFromPrincipal(token);
|
Account account = keyCloakService.createAccountFromPrincipal(token);
|
||||||
@ -196,22 +197,23 @@ public class Gruppen2Controller {
|
|||||||
|
|
||||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator"})
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator"})
|
||||||
@PostMapping("/leaveGroup")
|
@PostMapping("/leaveGroup")
|
||||||
public String pLeaveGroup(KeycloakAuthenticationToken token, @RequestParam(value = "group_id") Long id) {
|
public String pLeaveGroup(KeycloakAuthenticationToken token, @RequestParam (value="group_id") Long id) throws EventException {
|
||||||
Account account = keyCloakService.createAccountFromPrincipal(token);
|
Account account = keyCloakService.createAccountFromPrincipal(token);
|
||||||
User user = new User(account.getName(), account.getGivenname(), account.getFamilyname(), account.getEmail());
|
User user = new User(account.getName(), account.getGivenname(), account.getFamilyname(), account.getEmail());
|
||||||
controllerService.deleteUser(user, id);
|
controllerService.deleteUser(user.getUser_id(), id);
|
||||||
return "redirect:/gruppen2/";
|
return "redirect:/gruppen2/";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator)"})
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator)"})
|
||||||
@GetMapping("/details/members")
|
@GetMapping("/details/members/{id}")
|
||||||
public String editMembers(Model model, KeycloakAuthenticationToken token, @RequestParam (value = "group_id") Long id) throws EventException {
|
public String editMembers(Model model, KeycloakAuthenticationToken token, @PathVariable (value="id") Long id) throws EventException {
|
||||||
Account account = keyCloakService.createAccountFromPrincipal(token);
|
Account account = keyCloakService.createAccountFromPrincipal(token);
|
||||||
Group group = userService.getGroupById(id);
|
Group group = userService.getGroupById(id);
|
||||||
if(group.getRoles().get(account.getName()) == Role.ADMIN) {
|
if(group.getRoles().get(account.getName()) == Role.ADMIN) {
|
||||||
model.addAttribute("account", account);
|
model.addAttribute("account", account);
|
||||||
model.addAttribute("members", group.getMembers());
|
model.addAttribute("members", group.getMembers());
|
||||||
model.addAttribute("group", group);
|
model.addAttribute("group", group);
|
||||||
|
model.addAttribute("admin", Role.ADMIN);
|
||||||
return "editMembers";
|
return "editMembers";
|
||||||
} else {
|
} else {
|
||||||
return "redirect:/details/";
|
return "redirect:/details/";
|
||||||
@ -219,13 +221,20 @@ public class Gruppen2Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator)"})
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator)"})
|
||||||
@PostMapping("/changeRole")
|
@PostMapping("/details/members/changeRole")
|
||||||
public String changeRole(KeycloakAuthenticationToken token, @RequestParam (value = "group_id") Long id,
|
public String changeRole(KeycloakAuthenticationToken token, @RequestParam (value = "group_id") Long group_id,
|
||||||
@RequestParam (value = "user") User user) throws EventException {
|
@RequestParam (value = "user_id") String user_id) throws EventException {
|
||||||
controllerService.updateRole(user, id);
|
controllerService.updateRole(user_id, group_id);
|
||||||
return "redirect:/details/members/";
|
return "redirect:/gruppen2/details/members/" + group_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator)"})
|
||||||
|
@PostMapping("/details/members/deleteUser")
|
||||||
|
public String deleteUser(KeycloakAuthenticationToken token,@RequestParam (value = "group_id") Long group_id,
|
||||||
|
@RequestParam (value = "user_id") String user_id) throws EventException {
|
||||||
|
controllerService.deleteUser(user_id, group_id);
|
||||||
|
return "redirect:/gruppen2/details/members/" + group_id;
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("*")
|
@GetMapping("*")
|
||||||
public String defaultLink() {
|
public String defaultLink() {
|
||||||
|
|||||||
@ -5,7 +5,10 @@ import mops.gruppen2.domain.Exceptions.EventException;
|
|||||||
import mops.gruppen2.domain.event.*;
|
import mops.gruppen2.domain.event.*;
|
||||||
import mops.gruppen2.security.Account;
|
import mops.gruppen2.security.Account;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import java.util.*;
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ControllerService {
|
public class ControllerService {
|
||||||
@ -47,7 +50,7 @@ public class ControllerService {
|
|||||||
addUser(account, group_id);
|
addUser(account, group_id);
|
||||||
updateTitle(account, group_id, title);
|
updateTitle(account, group_id, title);
|
||||||
updateDescription(account, group_id, description);
|
updateDescription(account, group_id, description);
|
||||||
updateRole(user, group_id);
|
updateRole(user.getUser_id(), group_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createInviteLink(Long group_id) {
|
private void createInviteLink(Long group_id) {
|
||||||
@ -77,9 +80,14 @@ public class ControllerService {
|
|||||||
eventService.saveEvent(updateGroupDescriptionEvent);
|
eventService.saveEvent(updateGroupDescriptionEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateRole(User user, Long group_id) throws EventException {
|
public void updateRole(String user_id, Long group_id) throws EventException {
|
||||||
UpdateRoleEvent updateRoleEvent;
|
UpdateRoleEvent updateRoleEvent;
|
||||||
Group group = userService.getGroupById(group_id);
|
Group group = userService.getGroupById(group_id);
|
||||||
|
User user = null;
|
||||||
|
for (User member : group.getMembers()) {
|
||||||
|
if(member.getUser_id().equals(user_id)) user = member;
|
||||||
|
}
|
||||||
|
assert user != null;
|
||||||
if(group.getRoles().get(user.getUser_id()) == Role.ADMIN) {
|
if(group.getRoles().get(user.getUser_id()) == Role.ADMIN) {
|
||||||
updateRoleEvent = new UpdateRoleEvent(group_id, user.getUser_id(), Role.MEMBER);
|
updateRoleEvent = new UpdateRoleEvent(group_id, user.getUser_id(), Role.MEMBER);
|
||||||
} else {
|
} else {
|
||||||
@ -88,11 +96,22 @@ public class ControllerService {
|
|||||||
eventService.saveEvent(updateRoleEvent);
|
eventService.saveEvent(updateRoleEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteUser(User user, Long group_id){
|
public void deleteUser(String user_id, Long group_id) throws EventException {
|
||||||
|
Group group = userService.getGroupById(group_id);
|
||||||
|
User user = null;
|
||||||
|
for (User member : group.getMembers()) {
|
||||||
|
if(member.getUser_id().equals(user_id)) user = member;
|
||||||
|
}
|
||||||
|
assert user != null;
|
||||||
DeleteUserEvent deleteUserEvent = new DeleteUserEvent(group_id, user.getUser_id());
|
DeleteUserEvent deleteUserEvent = new DeleteUserEvent(group_id, user.getUser_id());
|
||||||
eventService.saveEvent(deleteUserEvent);
|
eventService.saveEvent(deleteUserEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteGroupEvent(User user, Long group_id) {
|
||||||
|
DeleteGroupEvent deleteGroupEvent = new DeleteGroupEvent(group_id, user.getUser_id());
|
||||||
|
eventService.saveEvent(deleteGroupEvent);
|
||||||
|
}
|
||||||
|
|
||||||
public void createLecture(Account account, String title, String description, Boolean visibility, List<User> users) throws EventException {
|
public void createLecture(Account account, String title, String description, Boolean visibility, List<User> users) throws EventException {
|
||||||
Visibility visibility1;
|
Visibility visibility1;
|
||||||
Long group_id = eventService.checkGroup();
|
Long group_id = eventService.checkGroup();
|
||||||
@ -105,17 +124,12 @@ public class ControllerService {
|
|||||||
|
|
||||||
CreateGroupEvent createGroupEvent = new CreateGroupEvent(group_id, account.getName(), null, GroupType.LECTURE, visibility1);
|
CreateGroupEvent createGroupEvent = new CreateGroupEvent(group_id, account.getName(), null, GroupType.LECTURE, visibility1);
|
||||||
eventService.saveEvent(createGroupEvent);
|
eventService.saveEvent(createGroupEvent);
|
||||||
User user = new User(account.getName(), account.getGivenname(), account.getFamilyname(), account.getEmail());
|
|
||||||
|
|
||||||
addUser(account, group_id);
|
addUser(account, group_id);
|
||||||
updateTitle(account, group_id, title);
|
updateTitle(account, group_id, title);
|
||||||
updateDescription(account, group_id, description);
|
updateDescription(account, group_id, description);
|
||||||
updateRole(user, group_id);
|
updateRole(account.getName(), group_id);
|
||||||
addUserList(users, group_id);
|
addUserList(users, group_id);
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteGroupEvent(User user, Long group_id) {
|
|
||||||
DeleteGroupEvent deleteGroupEvent = new DeleteGroupEvent(group_id, user.getUser_id());
|
|
||||||
eventService.saveEvent(deleteGroupEvent);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import mops.gruppen2.domain.Group;
|
|||||||
import mops.gruppen2.domain.Visibility;
|
import mops.gruppen2.domain.Visibility;
|
||||||
import mops.gruppen2.domain.event.Event;
|
import mops.gruppen2.domain.event.Event;
|
||||||
import mops.gruppen2.repository.EventRepository;
|
import mops.gruppen2.repository.EventRepository;
|
||||||
|
import mops.gruppen2.security.Account;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -71,15 +72,21 @@ public class GroupService {
|
|||||||
return groups.get(group_id);
|
return groups.get(group_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<Long> removeUserGroups(List<Long> group_ids, List<Long> user_groups) {
|
||||||
|
for (Long group_id: user_groups) {
|
||||||
|
group_ids.remove(group_id);
|
||||||
|
}
|
||||||
|
return group_ids;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sucht alle Zeilen in der DB wo die Visibility gleich true ist und wandelt diese in
|
* sucht alle Zeilen in der DB wo die Visibility true ist und entfernt alle Gruppen des Users.
|
||||||
* eine Liste von Gruppen
|
* Erstellt eine Liste aus Gruppen.
|
||||||
* @return
|
* @return
|
||||||
* @throws EventException
|
* @throws EventException
|
||||||
*/
|
*/
|
||||||
|
public List<Group> getAllGroupWithVisibilityPublic(String user_id) throws EventException {
|
||||||
public List<Group> getAllGroupWithVisibilityPublic() throws EventException {
|
List<Long> group_ids = removeUserGroups(eventRepository.findGroup_idsWhereVisibility(Boolean.TRUE), eventRepository.findGroup_idsWhereUser_id(user_id));
|
||||||
List<Long> group_ids = eventRepository.findGroup_idsWhereVisibility(Boolean.TRUE);
|
|
||||||
List<EventDTO> eventDTOS = eventRepository.findAllEventsOfGroups(group_ids);
|
List<EventDTO> eventDTOS = eventRepository.findAllEventsOfGroups(group_ids);
|
||||||
List<Event> events = eventService.translateEventDTOs(eventDTOS);
|
List<Event> events = eventService.translateEventDTOs(eventDTOS);
|
||||||
List<Group> groups = projectEventList(events);
|
List<Group> groups = projectEventList(events);
|
||||||
@ -94,10 +101,10 @@ public class GroupService {
|
|||||||
* @return
|
* @return
|
||||||
* @throws EventException
|
* @throws EventException
|
||||||
*/
|
*/
|
||||||
public List<Group> findGroupWith(String search) throws EventException {
|
public List<Group> findGroupWith(String search, Account account) throws EventException {
|
||||||
List<Group> groups = new ArrayList<>();
|
List<Group> groups = new ArrayList<>();
|
||||||
for (Group group: getAllGroupWithVisibilityPublic()) {
|
for (Group group: getAllGroupWithVisibilityPublic(account.getName())) {
|
||||||
if (group.getTitle().contains(search)|| group.getDescription().contains(search)){
|
if (group.getTitle().toLowerCase().contains(search.toLowerCase()) || group.getDescription().toLowerCase().contains(search.toLowerCase())){
|
||||||
groups.add(group);
|
groups.add(group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,33 +31,39 @@
|
|||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col-9">
|
<div class="col-9 shadow-sm p-4" style="border: 10px solid aliceblue; background: aliceblue">
|
||||||
<div class="shadow-sm p-4" style="border: 10px solid aliceblue; background: aliceblue">
|
<h1 style="color: black; font-weight: bold" th:text="${group.getTitle()}"></h1>
|
||||||
<h1 style="color: dodgerblue; font-weight: bold" th:text="${group.getTitle()}"></h1>
|
<h3>
|
||||||
<p style="font-weight: bold">
|
|
||||||
<span class="badge badge-pill badge-dark" style="background: darkslategray" th:if='${group.getVisibility() == group.getVisibility().PRIVATE }'>Private Gruppe</span>
|
<span class="badge badge-pill badge-dark" style="background: darkslategray" th:if='${group.getVisibility() == group.getVisibility().PRIVATE }'>Private Gruppe</span>
|
||||||
<span class="badge badge-pill badge-primary" th:if="${group.getVisibility() == group.getVisibility().PUBLIC}">Öffentliche Gruppe</span>
|
<span class="badge badge-pill badge-primary" th:if="${group.getVisibility() == group.getVisibility().PUBLIC}">Öffentliche Gruppe</span>
|
||||||
<span class="badge badge-pill badge-success" style="background: lightseagreen" th:if='${group.getType() == group.getType().LECTURE}'> Veranstaltung</span>
|
<span class="badge badge-pill badge-success" style="background: lightseagreen" th:if='${group.getType() == group.getType().LECTURE}'> Veranstaltung</span>
|
||||||
</p>
|
</h3>
|
||||||
<p style="overflow-wrap: break-word" th:text="${group.getDescription()}"></p>
|
<br>
|
||||||
<div class="form-group">
|
<div class="shadow-sm p-4" style="background: white">
|
||||||
<div class="text-right">
|
<p style="overflow-wrap: break-word" th:text="${group.getDescription()}"></p>
|
||||||
<form method="post" action="/gruppen2/leaveGroup">
|
</div>
|
||||||
<button th:value="${group.getId()}" th:name="group_id" class="btn btn-danger" type="submit" style="border-style: none;">Gruppe verlassen</button>
|
<br>
|
||||||
</form>
|
<div class="text-right btn-toolbar" style="float: right" role="toolbar">
|
||||||
</div>
|
<button class="btn btn-primary" style="background: dodgerblue; border: none; margin: 5px">
|
||||||
|
<a th:href="@{/gruppen2}" style="color: white">Zurück</a>
|
||||||
|
</button>
|
||||||
|
<form method="post" action="/gruppen2/leaveGroup">
|
||||||
|
<button th:value="${group.getId()}" th:name="group_id" class="btn btn-danger" type="submit" style="border-style: none; margin: 5px">Gruppe verlassen</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3" style="white-space: nowrap">
|
<div class="col-3" style="white-space: nowrap">
|
||||||
<div>
|
<div style="display: inline-block; margin: 0">
|
||||||
<h2 style="display: inline-block; margin: 0">Mitglieder</h2>
|
<h2>Mitglieder</h2>
|
||||||
<div th:if='${group.getRoles().get(user.getUser_id()) == admin}'>
|
<div th:if='${group.getRoles().get(user.getUser_id()) == admin}'>
|
||||||
<form method="get" action="/gruppen2/details/members">
|
<form method="get" th:action="@{/gruppen2/details/members/{id}(id=${group.getId()})}">
|
||||||
<button th:name="group_id" th:value="${group.getId()}" class="btn btn-secondary" type="submit" style="background: slategrey; margin-top: 200px; float: right" >Mitglieder bearbeiten</button>
|
<button class="btn btn-secondary" style="background: slategrey; float: right" >
|
||||||
|
Mitglieder bearbeiten
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<p></p>
|
<br>
|
||||||
|
<br>
|
||||||
</div>
|
</div>
|
||||||
<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">
|
||||||
|
|||||||
@ -32,13 +32,15 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-9">
|
<div class="col-9">
|
||||||
<div class="shadow-sm p-4" style="border: 10px solid aliceblue; background: aliceblue">
|
<div class="shadow-sm p-4" style="border: 10px solid aliceblue; background: aliceblue">
|
||||||
<h1 style="color: dodgerblue; font-weight: bold" th:text="${group.getTitle()}"></h1>
|
<h1 style="color: black; font-weight: bold" th:text="${group.getTitle()}"></h1>
|
||||||
<p style="font-weight: bold">
|
<h3>
|
||||||
<span class="badge badge-pill badge-dark" style="background: darkslategray" th:if="${group.getVisibility() == group.getVisibility().PRIVATE }">Private Gruppe</span>
|
<span class="badge badge-pill badge-dark" style="background: darkslategray" th:if='${group.getVisibility() == group.getVisibility().PRIVATE }'>Private Gruppe</span>
|
||||||
<span class="badge badge-pill badge-primary" th:if="${group.getVisibility() == group.getVisibility().PUBLIC}">Öffentliche Gruppe</span>
|
<span class="badge badge-pill badge-primary" th:if="${group.getVisibility() == group.getVisibility().PUBLIC}">Öffentliche Gruppe</span>
|
||||||
<span class="badge badge-pill badge-success" style="background: lightseagreen" th:if="${group.getType() == group.getType().LECTURE}"> Veranstaltung</span>
|
<span class="badge badge-pill badge-success" style="background: lightseagreen" th:if='${group.getType() == group.getType().LECTURE}'> Veranstaltung</span>
|
||||||
</p>
|
</h3>
|
||||||
<p th:text="${group.getDescription()}"></p>
|
<div class="shadow-sm p-4" style="background: white">
|
||||||
|
<p style="overflow-wrap: break-word" th:text="${group.getDescription()}"></p>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
<form method="post" action="/gruppen2/detailsBeitreten">
|
<form method="post" action="/gruppen2/detailsBeitreten">
|
||||||
|
|||||||
@ -56,24 +56,36 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Mitglied</th>
|
<th scope="col">Mitglied</th>
|
||||||
<th scope="col">Rolle</th>
|
<th scope="col" style="width: 180px">Rolle</th>
|
||||||
<th scope="col" style="width: 320px">Optionen</th>
|
<th scope="col" style="width: 270px">Optionen</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="table-striped">
|
<tbody class="table-striped">
|
||||||
<tr th:each="member : ${group.getMembers()}">
|
|
||||||
|
<tr th:each="member : ${group.getMembers()}">
|
||||||
<th th:text="${member.getUser_id()}"></th>
|
<th th:text="${member.getUser_id()}"></th>
|
||||||
<td>
|
<td>
|
||||||
<span th:if='${group.getRoles().get(member.getUser_id()) == admin}'>Mitglied</span>
|
<span th:if='${group.getRoles().get(member.getUser_id()) != admin}'>Mitglied</span>
|
||||||
<span th:if='${group.getRoles().get(member.getUser_id()) != admin}'>Admin</span>
|
<span th:if='${group.getRoles().get(member.getUser_id()) == admin}'>Admin</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn btn-warning">Rolle ändern</button> <!-- th:if -->
|
<form method="post" action="/gruppen2/details/members/changeRole">
|
||||||
<button class="btn btn-danger">Mitglied entfernen</button>
|
<input type="hidden" th:name="group_id" th:value="${group.getId()}">
|
||||||
|
<input type="hidden" th:name="user_id" th:value="${member.getUser_id()}">
|
||||||
|
<button type="submit" class="btn btn-warning btn-sm">Rolle ändern</button><!-- th:if -->
|
||||||
|
</form>
|
||||||
|
<form method="post" action="/gruppen2/details/members/deleteUser">
|
||||||
|
<input type="hidden" th:name="group_id" th:value="${group.getId()}">
|
||||||
|
<input type="hidden" th:name="user_id" th:value="${member.getUser_id()}">
|
||||||
|
<button class="btn btn-danger btn-sm">Mitglied entfernen</button>
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<button type="button" class="btn btn-primary" style="background: #52a1eb; border-style: none">
|
||||||
|
<a th:href="@{/gruppen2/details(id=${group.getId()})}" style="color: white">Fertig</a>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -34,33 +34,27 @@
|
|||||||
<div class="col-10">
|
<div class="col-10">
|
||||||
<h1>Meine Gruppen</h1>
|
<h1>Meine Gruppen</h1>
|
||||||
<form action="/" method="get">
|
<form action="/" method="get">
|
||||||
|
<h3 style="color: dodgerblue; font-weight: bold;">
|
||||||
|
<small style="font-weight: normal; color: black">Mitglied in </small>
|
||||||
|
<small style="font-weight: bold; color: black" th:text="${gruppen.size()}"></small>
|
||||||
|
<small style="font-weight: normal; color: black" th:if='${gruppen.size()==1}'> Gruppe.</small>
|
||||||
|
<small style="font-weight: normal; color: black" th:if='${gruppen.size()!=1}'> Gruppen.</small>
|
||||||
|
</h3>
|
||||||
|
<br>
|
||||||
<div th:each="gruppe: ${gruppen}">
|
<div th:each="gruppe: ${gruppen}">
|
||||||
<div class="shadow-sm p-4" style="border: none; background: aliceblue">
|
<div class="shadow-sm p-4" style="border: none; background: aliceblue">
|
||||||
|
|
||||||
<h3 style="color: dodgerblue; font-weight: bold;">
|
<h3 style="color: dodgerblue; font-weight: bold;">
|
||||||
<a th:href="@{/gruppen2/details(id=${gruppe.getId()})}" th:text="${gruppe.getTitle()}"></a>
|
<a th:href="@{/gruppen2/details/{id}(id=${gruppe.getId()})}" th:text="${gruppe.getTitle()}"></a>
|
||||||
</h3>
|
</h3>
|
||||||
<p style="overflow-wrap: break-word" th:text="${#strings.abbreviate(gruppe.getDescription(),300)}"></p>
|
<div class="shadow-sm p-4" style="background: white">
|
||||||
|
<p style="overflow-wrap: break-word" th:text="${#strings.abbreviate(gruppe.getDescription(),300)}"></p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-2">
|
|
||||||
<div class="card" style="background: lightgrey">
|
|
||||||
<div class="card-body">
|
|
||||||
<h2 class="card-title" th:text="${user.getUser_id()}" style="text-align: center">user_id</h2>
|
|
||||||
<h3 class="card-text">
|
|
||||||
<span th:text="${user.getGivenname()}">username</span>
|
|
||||||
<span th:text="${user.getFamilyname()}">usersurname</span>
|
|
||||||
</h3>
|
|
||||||
<p class="card-text" th:text="${user.getEmail()}">usermail</p>
|
|
||||||
<p>
|
|
||||||
<small class="card-text">In Gruppen:</small>
|
|
||||||
<small class="card-text" th:text="${gruppen.size()}"></small>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
Reference in New Issue
Block a user