new mappings
This commit is contained in:
@ -42,7 +42,6 @@ public class GroupDetailsController {
|
||||
this.projectionService = projectionService;
|
||||
}
|
||||
|
||||
//TODO: /details/{id}
|
||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||
@GetMapping("/details/{id}")
|
||||
public String getDetailsPage(KeycloakAuthenticationToken token,
|
||||
@ -74,12 +73,11 @@ public class GroupDetailsController {
|
||||
return "detailsMember";
|
||||
}
|
||||
|
||||
//TODO: /details/{id}/join
|
||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||
@PostMapping("/join")
|
||||
@PostMapping("/details/{id}/join")
|
||||
@CacheEvict(value = "groups", allEntries = true)
|
||||
public String postDetailsJoin(KeycloakAuthenticationToken token,
|
||||
@RequestParam("id") String groupId) {
|
||||
@PathVariable("id") String groupId) {
|
||||
|
||||
User user = new User(token);
|
||||
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
||||
@ -89,12 +87,11 @@ public class GroupDetailsController {
|
||||
return "redirect:/gruppen2/details/" + groupId;
|
||||
}
|
||||
|
||||
//TODO: /details/{id}/leave
|
||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||
@PostMapping("/leave")
|
||||
@PostMapping("/details/{id}/leave")
|
||||
@CacheEvict(value = "groups", allEntries = true)
|
||||
public String postDetailsLeave(KeycloakAuthenticationToken token,
|
||||
@RequestParam("group_id") String groupId) {
|
||||
@PathVariable("id") String groupId) {
|
||||
|
||||
User user = new User(token);
|
||||
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
||||
@ -104,12 +101,11 @@ public class GroupDetailsController {
|
||||
return "redirect:/gruppen2";
|
||||
}
|
||||
|
||||
//TODO: /details/{id}/destroy
|
||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||
@PostMapping("/delete")
|
||||
@PostMapping("/details/{id}/destroy")
|
||||
@CacheEvict(value = "groups", allEntries = true)
|
||||
public String postDetailsDestroy(KeycloakAuthenticationToken token,
|
||||
@RequestParam("group_id") String groupId) {
|
||||
@PathVariable("id") String groupId) {
|
||||
|
||||
User user = new User(token);
|
||||
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
||||
@ -119,9 +115,8 @@ public class GroupDetailsController {
|
||||
return "redirect:/gruppen2";
|
||||
}
|
||||
|
||||
//TODO: /details/{id}/meta
|
||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||
@GetMapping("/details/meta/{id}")
|
||||
@GetMapping("/details/{id}/meta")
|
||||
public String getDetailsMeta(KeycloakAuthenticationToken token,
|
||||
Model model,
|
||||
@PathVariable("id") String groupId) {
|
||||
@ -136,14 +131,13 @@ public class GroupDetailsController {
|
||||
return "changeMetadata";
|
||||
}
|
||||
|
||||
//TODO: /details/{id}/meta/update
|
||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||
@PostMapping("/details/meta")
|
||||
@PostMapping("/details/{id}/meta/update")
|
||||
@CacheEvict(value = "groups", allEntries = true)
|
||||
public String postDetailsMetaUpdate(KeycloakAuthenticationToken token,
|
||||
@PathVariable("id") String groupId,
|
||||
@RequestParam("title") String title,
|
||||
@RequestParam("description") String description,
|
||||
@RequestParam("groupId") String groupId) {
|
||||
@RequestParam("description") String description) {
|
||||
|
||||
User user = new User(token);
|
||||
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
||||
@ -154,9 +148,8 @@ public class GroupDetailsController {
|
||||
return "redirect:/gruppen2/details/" + groupId;
|
||||
}
|
||||
|
||||
//TODO: /details/{id}/members
|
||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||
@GetMapping("/details/members/{id}")
|
||||
@GetMapping("/details/{id}/members")
|
||||
public String getDetailsMembers(KeycloakAuthenticationToken token,
|
||||
Model model,
|
||||
@PathVariable("id") String groupId) {
|
||||
@ -171,28 +164,26 @@ public class GroupDetailsController {
|
||||
return "editMembers";
|
||||
}
|
||||
|
||||
//TODO: /details/{id}/members/update/userlimit
|
||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||
@PostMapping("/details/members/setuserlimit")
|
||||
@PostMapping("/details/{id}/members/update/userlimit")
|
||||
@CacheEvict(value = "groups", allEntries = true)
|
||||
public String postDetailsMembersUpdateUserLimit(KeycloakAuthenticationToken token,
|
||||
@RequestParam("maximum") long userLimit,
|
||||
@RequestParam("group_id") String groupId) {
|
||||
@PathVariable("id") String groupId,
|
||||
@RequestParam("maximum") long userLimit) {
|
||||
|
||||
User user = new User(token);
|
||||
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
||||
|
||||
groupService.updateUserLimit(user, group, userLimit);
|
||||
|
||||
return "redirect:/gruppen2/details/members/" + groupId;
|
||||
return "redirect:/gruppen2/details/" + groupId + "/members";
|
||||
}
|
||||
|
||||
//TODO: /details/{id}/members/update/csv
|
||||
@RolesAllowed("ROLE_orga")
|
||||
@PostMapping("/details/members/csv")
|
||||
@PostMapping("/details/{id}/members/update/csv")
|
||||
@CacheEvict(value = "groups", allEntries = true)
|
||||
public String postDetailsMembersUpdateCsv(KeycloakAuthenticationToken token,
|
||||
@RequestParam("group_id") String groupId,
|
||||
@PathVariable("id") String groupId,
|
||||
@RequestParam(value = "file", required = false) MultipartFile file) {
|
||||
|
||||
User user = new User(token);
|
||||
@ -200,18 +191,17 @@ public class GroupDetailsController {
|
||||
|
||||
groupService.addUsersToGroup(CsvService.readCsvFile(file), group, user);
|
||||
|
||||
return "redirect:/gruppen2/details/members/" + groupId;
|
||||
return "redirect:/gruppen2/details/" + groupId + "/members";
|
||||
}
|
||||
|
||||
//TODO: Method + view for /details/{id}/members/{id}
|
||||
|
||||
//TODO: /details/{id}/members/{id}/update/role
|
||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||
@PostMapping("/details/members/togglerole")
|
||||
@PostMapping("/details/{id}/members/{userid}/update/role")
|
||||
@CacheEvict(value = "groups", allEntries = true)
|
||||
public String postDetailsMembersUpdateRole(KeycloakAuthenticationToken token,
|
||||
@RequestParam("group_id") String groupId,
|
||||
@RequestParam("user_id") String userId) {
|
||||
@PathVariable("id") String groupId,
|
||||
@PathVariable("userid") String userId) {
|
||||
|
||||
User user = new User(token);
|
||||
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
||||
@ -225,16 +215,15 @@ public class GroupDetailsController {
|
||||
return "redirect:/gruppen2/details/" + groupId;
|
||||
}
|
||||
|
||||
return "redirect:/gruppen2/details/members/" + groupId;
|
||||
return "redirect:/gruppen2/details/" + groupId + "/members";
|
||||
}
|
||||
|
||||
//TODO: /details/{id}/members/{id}/delete
|
||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||
@PostMapping("/details/members/deleteuser")
|
||||
@PostMapping("/details/{id}/members/{userid}/delete")
|
||||
@CacheEvict(value = "groups", allEntries = true)
|
||||
public String postDetailsMembersDelete(KeycloakAuthenticationToken token,
|
||||
@RequestParam("group_id") String groupId,
|
||||
@RequestParam("user_id") String userId) {
|
||||
@PathVariable("id") String groupId,
|
||||
@PathVariable("userid") String userId) {
|
||||
|
||||
User user = new User(token);
|
||||
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
||||
@ -246,6 +235,6 @@ public class GroupDetailsController {
|
||||
groupService.deleteUser(new User(userId), group);
|
||||
}
|
||||
|
||||
return "redirect:/gruppen2/details/members/" + groupId;
|
||||
return "redirect:/gruppen2/details/" + groupId + "/members";
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@ -38,22 +39,20 @@ public class SearchAndInviteController {
|
||||
this.searchService = searchService;
|
||||
}
|
||||
|
||||
//TODO: /search
|
||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||
@GetMapping("/searchPage")
|
||||
public String getSearchPage(Model model) {
|
||||
@GetMapping("/search")
|
||||
public String getSearch(Model model) {
|
||||
// Noch keine Suche gestartet: leeres Suchergebnis
|
||||
model.addAttribute("gruppen", Collections.emptyList());
|
||||
|
||||
return "search";
|
||||
}
|
||||
|
||||
//TODO: /search/{string}
|
||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||
@GetMapping("/search")
|
||||
public String getSearch(KeycloakAuthenticationToken token,
|
||||
Model model,
|
||||
@RequestParam("suchbegriff") String search) {
|
||||
@PostMapping("/search")
|
||||
public String postSearch(KeycloakAuthenticationToken token,
|
||||
Model model,
|
||||
@RequestParam("string") String search) {
|
||||
|
||||
User user = new User(token);
|
||||
List<Group> groups = searchService.searchPublicGroups(search, user);
|
||||
|
@ -30,7 +30,7 @@
|
||||
<a href="/create/student" th:href="@{/gruppen2/create/student}">Erstellen</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/searchPage" th:href="@{/gruppen2/searchPage}">Suche</a>
|
||||
<a href="/search" th:href="@{/gruppen2/search}">Suche</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
@ -40,7 +40,7 @@
|
||||
<div class="row">
|
||||
<div class="col-10">
|
||||
<h1>Metadaten ändern</h1>
|
||||
<form method="post" th:action="@{/gruppen2/details/changeMetadata}">
|
||||
<form method="post" th:action="@{/gruppen2/details/{id}/meta/update(id=${group.getId()})}">
|
||||
<div class="shadow-sm p-2"
|
||||
style=" border: 10px solid aliceblue; background: aliceblue;">
|
||||
<div class="form-group">
|
||||
@ -58,8 +58,6 @@
|
||||
<button class="btn btn-primary"
|
||||
style="background: #52a1eb; border-style: none;"
|
||||
th:if="${group.getRoles().get(user.getId()) == admin}"
|
||||
th:name="groupId"
|
||||
th:value="${group.getId()}"
|
||||
type="submit">Speichern
|
||||
</button>
|
||||
</div>
|
||||
|
@ -31,7 +31,7 @@
|
||||
<a href="/create/student" th:href="@{/gruppen2/create/student}">Erstellen</a>
|
||||
</li>
|
||||
<li>
|
||||
<a th:href="@{/gruppen2/searchPage}" href="/searchPage">Suche</a>
|
||||
<a th:href="@{/gruppen2/search}" href="/search">Suche</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<a href="/create/student" th:href="@{/gruppen2/create/student}">Erstellen</a>
|
||||
</li>
|
||||
<li>
|
||||
<a th:href="@{/gruppen2/searchPage}" href="/searchPage">Suche</a>
|
||||
<a th:href="@{/gruppen2/search}" href="/search">Suche</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
@ -24,7 +24,7 @@
|
||||
<a href="/create/student" th:href="@{/gruppen2/create/student}">Erstellen</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/searchPage" th:href="@{/gruppen2/searchPage}">Suche</a>
|
||||
<a href="/search" th:href="@{/gruppen2/search}">Suche</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
@ -42,7 +42,7 @@
|
||||
<div class="col-1">
|
||||
<a class="fa fa-pencil"
|
||||
style="font-size:30px; width: 5%;"
|
||||
th:href="@{/gruppen2/details/changeMetadata/{id}(id=${group.getId()})}"
|
||||
th:href="@{/gruppen2/details/{id}/meta(id=${group.getId()})}"
|
||||
th:if="${group.getRoles().get(user.getId()) == admin}"></a>
|
||||
</div>
|
||||
</div>
|
||||
@ -83,15 +83,14 @@
|
||||
style="background: #52a1eb; border: none; margin: 5px;">
|
||||
<a style="color: white;" th:href="@{/gruppen2}">Zurück</a>
|
||||
</button>
|
||||
<form method="post" th:action="@{/gruppen2/leaveGroup}">
|
||||
<form method="post" th:action="@{/gruppen2/details/{id}/leave(id=${group.getId()})}">
|
||||
<button class="btn btn-danger" style="border-style: none; margin: 5px;"
|
||||
th:name="group_id" th:value="${group.getId()}"
|
||||
th:name="group_id"
|
||||
type="submit">Gruppe verlassen
|
||||
</button>
|
||||
</form>
|
||||
<form method="post" th:action="@{/gruppen2/deleteGroup}">
|
||||
<button class="btn btn-danger" style="border-style: none; margin: 5px;"
|
||||
th:name="group_id" th:value="${group.getId()}"
|
||||
<form method="post" th:action="@{/gruppen2/details/{id}/destroy(id=${group.getId()})}">
|
||||
<button class="btn btn-danger" style="border-style: none; margin: 5px;" th:name="group_id"
|
||||
th:if="${group.getRoles().get(user.getId()) == admin}"
|
||||
type="submit">Gruppe löschen
|
||||
</button>
|
||||
@ -111,7 +110,7 @@
|
||||
</div>
|
||||
<div th:if="${group.getRoles().get(user.getId()) == admin}">
|
||||
<form method="get"
|
||||
th:action="@{/gruppen2/details/members/{id}(id=${group.getId()})}">
|
||||
th:action="@{/gruppen2/details/{id}/members(id=${group.getId()})}">
|
||||
<button class="btn btn-secondary" style="background: slategrey; float: left;">
|
||||
Mitglieder bearbeiten
|
||||
</button>
|
||||
|
@ -22,7 +22,7 @@
|
||||
<a href="/create/student" th:href="@{/gruppen2/create/student}">Erstellen</a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<a th:href="@{/gruppen2/searchPage}" href="/searchPage">Suche</a>
|
||||
<a th:href="@{/gruppen2/search}" href="/search">Suche</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
@ -46,6 +46,10 @@
|
||||
<p style="overflow-wrap: break-word; font-optical-sizing: auto;"
|
||||
th:text="${group.getDescription()}"></p>
|
||||
</div>
|
||||
<form class="mt-3" th:if="${group.getVisibility() == public}" method="post"
|
||||
th:action="@{/gruppen2/details/{id}/join(id=${group.getId()})}">
|
||||
<button class="btn btn-primary" type="submit">Beitreten!</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<a href="/create/student" th:href="@{/gruppen2/create/student}">Erstellen</a>
|
||||
</li>
|
||||
<li>
|
||||
<a th:href="@{/gruppen2/searchPage}" href="/searchPage">Suche</a>
|
||||
<a th:href="@{/gruppen2/search}" href="/search">Suche</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
@ -49,9 +49,8 @@
|
||||
</div>
|
||||
<div class="shadow p-2" style="border: 10px solid aliceblue; background: aliceblue;">
|
||||
<div class="form-group pt-4" th:if="${account.getRoles().contains('orga')}">
|
||||
<form th:action="@{/gruppen2/details/members/addUsersFromCsv}"
|
||||
enctype="multipart/form-data"
|
||||
method="post">
|
||||
<form th:action="@{/gruppen2/details/{id}/members/update/csv(id=${group.getId()})}"
|
||||
enctype="multipart/form-data" method="post">
|
||||
<div class="input-group mb-3">
|
||||
<div class="custom-file">
|
||||
<input class="custom-file-input" id="file" th:name="file"
|
||||
@ -63,8 +62,7 @@
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-secondary"
|
||||
style="background: #52a1eb; border-style: none;"
|
||||
th:name="group_id" th:value="${group.getId()}"
|
||||
type="submit">
|
||||
th:name="group_id" type="submit">
|
||||
<a style="color: white;">Hinzufügen</a>
|
||||
</button>
|
||||
</div>
|
||||
@ -72,7 +70,7 @@
|
||||
</form>
|
||||
</div>
|
||||
<div class="form-group pt-4">
|
||||
<form method="post" th:action="@{/gruppen2/details/members/changeMaximum}">
|
||||
<form method="post" th:action="@{/gruppen2/details/{id}/members/update/userlimit(id=${group.getId()})}">
|
||||
<div class="input-group mb-3" id="userMaximum">
|
||||
<label for="teilnehmerzahl"></label>
|
||||
<input class="form-control"
|
||||
@ -84,8 +82,7 @@
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-secondary"
|
||||
style="background: #52a1eb; border-style: none;"
|
||||
th:name="group_id" th:value="${group.getId()}"
|
||||
type="submit">
|
||||
th:name="group_id" type="submit">
|
||||
<a style="color: white;">Speichern</a>
|
||||
</button>
|
||||
</div>
|
||||
@ -111,21 +108,13 @@
|
||||
<td>
|
||||
<div class="text-right btn-toolbar" style="float: right;" role="toolbar">
|
||||
<form method="post"
|
||||
th:action="@{/gruppen2/details/members/changeRole}">
|
||||
<input th:name="group_id" th:value="${group.getId()}"
|
||||
type="hidden">
|
||||
<input th:name="user_id" th:value="${member.getId()}"
|
||||
type="hidden">
|
||||
th:action="@{/gruppen2/details/{id}/members/{userid}/update/role(id=${group.getId()}, userid=${member.getId()})}">
|
||||
<button class="btn btn-warning btn-sm" type="submit"
|
||||
style="margin: 5px;">Rolle ändern
|
||||
</button>
|
||||
</form>
|
||||
<form method="post"
|
||||
th:action="@{/gruppen2/details/members/deleteUser}">
|
||||
<input th:name="group_id" th:value="${group.getId()}"
|
||||
type="hidden">
|
||||
<input th:name="user_id" th:value="${member.getId()}"
|
||||
type="hidden">
|
||||
th:action="@{/gruppen2/details/{id}/members/{userid}/delete(id=${group.getId()}, userid=${member.getId()})}">
|
||||
<button class="btn btn-danger btn-sm" style="margin: 5px;"
|
||||
th:if='!${account.getName().equals(member.getId())}'>
|
||||
Mitglied entfernen
|
||||
|
@ -23,7 +23,7 @@
|
||||
<a href="/create/student" th:href="@{/gruppen2/create/student}">Erstellen</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/searchPage" th:href="@{/gruppen2/searchPage}">Suche</a>
|
||||
<a href="/search" th:href="@{/gruppen2/search}">Suche</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
@ -25,7 +25,7 @@
|
||||
<a href="/create/student" th:href="@{/gruppen2/create/student}">Erstellen</a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<a href="/searchPage" th:href="@{/gruppen2/searchPage}">Suche</a>
|
||||
<a href="/search" th:href="@{/gruppen2/search}">Suche</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
@ -44,7 +44,7 @@
|
||||
<div class="form-group mt-2" th:if="${group.getMembers().size() < group.getUserLimit()}">
|
||||
<h3>Möchtest du dieser privaten Gruppe beitreten?</h3>
|
||||
<div class="text-right">
|
||||
<form method="post" th:action="@{/gruppen2/join}">
|
||||
<form method="post" th:action="@{/gruppen2/details/{id}/join(id = ${group.getId()})}">
|
||||
<input name="id" th:value="${group.getId()}" type="hidden"/>
|
||||
<button class="btn btn-primary"
|
||||
style="background: #52a1eb; border-style: none;"
|
||||
|
@ -23,7 +23,7 @@
|
||||
<a href="/create/student" th:href="@{/gruppen2/create/student}">Erstellen</a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<a th:href="@{/gruppen2/searchPage}" href="/searchPage">Suche</a>
|
||||
<a th:href="@{/gruppen2/search}" href="/search">Suche</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
@ -35,20 +35,15 @@
|
||||
<h1>Gruppensuche</h1>
|
||||
<div class="shadow-sm p-2"
|
||||
style="border: 10px solid aliceblue; border-radius: 5px; background: aliceblue;">
|
||||
<form method="get" th:action="@{/gruppen2/search}">
|
||||
<form method="post" th:action="@{/gruppen2/search}">
|
||||
<div class="form-group">
|
||||
<label for="suchleiste">Suchbegriff:</label>
|
||||
<input class="form-control" id="suchleiste"
|
||||
placeholder="z.B. Programmieren, Lerngruppe, ..."
|
||||
th:name="suchbegriff" type="text">
|
||||
th:name="string" type="text">
|
||||
</div>
|
||||
<button class="btn btn-primary"
|
||||
style="background: #52a1eb; border-style: none;"
|
||||
type="submit">Suchen
|
||||
</button>
|
||||
<button class="btn btn-primary" style="background: deepskyblue; border-style: none;" type="submit">
|
||||
<a href="/gruppen2/search?suchbegriff=" style="color: white;">Alle
|
||||
anzeigen</a>
|
||||
<button class="btn btn-primary" style="background: #52a1eb; border-style: none;" type="submit">
|
||||
Suchen
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user