Merge pull request #5 from ChUrl/REFACTOR-endpoint-mappings
Refactor endpoint mappings
This commit is contained in:
@ -47,8 +47,8 @@ public class APIController {
|
|||||||
@GetMapping("/update/{id}")
|
@GetMapping("/update/{id}")
|
||||||
@Secured("ROLE_api_user")
|
@Secured("ROLE_api_user")
|
||||||
@ApiOperation("Gibt veränderte Gruppen zurück")
|
@ApiOperation("Gibt veränderte Gruppen zurück")
|
||||||
public GroupRequestWrapper update(@ApiParam("Letzte gespeicherte EventId des Anfragestellers")
|
public GroupRequestWrapper getApiUpdate(@ApiParam("Letzte gespeicherte EventId des Anfragestellers")
|
||||||
@PathVariable("id") long eventId) {
|
@PathVariable("id") long eventId) {
|
||||||
|
|
||||||
return APIService.wrap(eventStoreService.findMaxEventId(),
|
return APIService.wrap(eventStoreService.findMaxEventId(),
|
||||||
projectionService.projectNewGroups(eventId));
|
projectionService.projectNewGroups(eventId));
|
||||||
@ -60,8 +60,8 @@ public class APIController {
|
|||||||
@GetMapping("/usergroups/{id}")
|
@GetMapping("/usergroups/{id}")
|
||||||
@Secured("ROLE_api_user")
|
@Secured("ROLE_api_user")
|
||||||
@ApiOperation("Gibt Gruppen zurück, in welchen ein Nutzer teilnimmt")
|
@ApiOperation("Gibt Gruppen zurück, in welchen ein Nutzer teilnimmt")
|
||||||
public List<String> usergroups(@ApiParam("Nutzer-Id")
|
public List<String> getApiUserGroups(@ApiParam("Nutzer-Id")
|
||||||
@PathVariable("id") String userId) {
|
@PathVariable("id") String userId) {
|
||||||
|
|
||||||
return IdService.uuidsToString(eventStoreService.findExistingUserGroups(new User(userId)));
|
return IdService.uuidsToString(eventStoreService.findExistingUserGroups(new User(userId)));
|
||||||
}
|
}
|
||||||
@ -72,8 +72,8 @@ public class APIController {
|
|||||||
@GetMapping("/group/{id}")
|
@GetMapping("/group/{id}")
|
||||||
@Secured("ROLE_api_user")
|
@Secured("ROLE_api_user")
|
||||||
@ApiOperation("Gibt die Gruppe mit der als Parameter mitgegebenden groupId zurück")
|
@ApiOperation("Gibt die Gruppe mit der als Parameter mitgegebenden groupId zurück")
|
||||||
public Group getGroupById(@ApiParam("Gruppen-Id der gefordeten Gruppe")
|
public Group getApiGroup(@ApiParam("Gruppen-Id der gefordeten Gruppe")
|
||||||
@PathVariable("id") String groupId) {
|
@PathVariable("id") String groupId) {
|
||||||
|
|
||||||
return projectionService.projectSingleGroup(UUID.fromString(groupId));
|
return projectionService.projectSingleGroup(UUID.fromString(groupId));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,19 +41,17 @@ public class GroupCreationController {
|
|||||||
this.projectionService = projectionService;
|
this.projectionService = projectionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: /create/orga
|
|
||||||
@RolesAllowed("ROLE_orga")
|
@RolesAllowed("ROLE_orga")
|
||||||
@GetMapping("/createOrga")
|
@GetMapping("/create/orga")
|
||||||
public String getCreateOrgaPage(Model model) {
|
public String getCreateOrga(Model model) {
|
||||||
|
|
||||||
model.addAttribute("lectures", projectionService.projectLectures());
|
model.addAttribute("lectures", projectionService.projectLectures());
|
||||||
|
|
||||||
return "createOrga";
|
return "createOrga";
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: /create/orga
|
|
||||||
@RolesAllowed("ROLE_orga")
|
@RolesAllowed("ROLE_orga")
|
||||||
@PostMapping("/createOrga")
|
@PostMapping("/create/orga")
|
||||||
@CacheEvict(value = "groups", allEntries = true)
|
@CacheEvict(value = "groups", allEntries = true)
|
||||||
public String postCreateOrga(KeycloakAuthenticationToken token,
|
public String postCreateOrga(KeycloakAuthenticationToken token,
|
||||||
@RequestParam("title") String title,
|
@RequestParam("title") String title,
|
||||||
@ -79,19 +77,17 @@ public class GroupCreationController {
|
|||||||
return "redirect:/gruppen2/details/" + IdService.uuidToString(group.getId());
|
return "redirect:/gruppen2/details/" + IdService.uuidToString(group.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: /create/student
|
|
||||||
@RolesAllowed("ROLE_studentin")
|
@RolesAllowed("ROLE_studentin")
|
||||||
@GetMapping("/createStudent")
|
@GetMapping("/create/student")
|
||||||
public String getCreateStudentPage(Model model) {
|
public String getCreateStudent(Model model) {
|
||||||
|
|
||||||
model.addAttribute("lectures", projectionService.projectLectures());
|
model.addAttribute("lectures", projectionService.projectLectures());
|
||||||
|
|
||||||
return "createStudent";
|
return "createStudent";
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: /create/student
|
|
||||||
@RolesAllowed("ROLE_studentin")
|
@RolesAllowed("ROLE_studentin")
|
||||||
@PostMapping("/createStudent")
|
@PostMapping("/create/student")
|
||||||
@CacheEvict(value = "groups", allEntries = true)
|
@CacheEvict(value = "groups", allEntries = true)
|
||||||
public String postCreateStudent(KeycloakAuthenticationToken token,
|
public String postCreateStudent(KeycloakAuthenticationToken token,
|
||||||
@RequestParam("title") String title,
|
@RequestParam("title") String title,
|
||||||
|
|||||||
@ -42,7 +42,6 @@ public class GroupDetailsController {
|
|||||||
this.projectionService = projectionService;
|
this.projectionService = projectionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: /details/{id}
|
|
||||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||||
@GetMapping("/details/{id}")
|
@GetMapping("/details/{id}")
|
||||||
public String getDetailsPage(KeycloakAuthenticationToken token,
|
public String getDetailsPage(KeycloakAuthenticationToken token,
|
||||||
@ -74,12 +73,11 @@ public class GroupDetailsController {
|
|||||||
return "detailsMember";
|
return "detailsMember";
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: /details/{id}/join
|
|
||||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||||
@PostMapping("/join")
|
@PostMapping("/details/{id}/join")
|
||||||
@CacheEvict(value = "groups", allEntries = true)
|
@CacheEvict(value = "groups", allEntries = true)
|
||||||
public String postDetailsJoin(KeycloakAuthenticationToken token,
|
public String postDetailsJoin(KeycloakAuthenticationToken token,
|
||||||
@RequestParam("id") String groupId) {
|
@PathVariable("id") String groupId) {
|
||||||
|
|
||||||
User user = new User(token);
|
User user = new User(token);
|
||||||
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
||||||
@ -89,12 +87,11 @@ public class GroupDetailsController {
|
|||||||
return "redirect:/gruppen2/details/" + groupId;
|
return "redirect:/gruppen2/details/" + groupId;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: /details/{id}/leave
|
|
||||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||||
@PostMapping("/leave")
|
@PostMapping("/details/{id}/leave")
|
||||||
@CacheEvict(value = "groups", allEntries = true)
|
@CacheEvict(value = "groups", allEntries = true)
|
||||||
public String postDetailsLeave(KeycloakAuthenticationToken token,
|
public String postDetailsLeave(KeycloakAuthenticationToken token,
|
||||||
@RequestParam("group_id") String groupId) {
|
@PathVariable("id") String groupId) {
|
||||||
|
|
||||||
User user = new User(token);
|
User user = new User(token);
|
||||||
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
||||||
@ -104,12 +101,11 @@ public class GroupDetailsController {
|
|||||||
return "redirect:/gruppen2";
|
return "redirect:/gruppen2";
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: /details/{id}/destroy
|
|
||||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||||
@PostMapping("/delete")
|
@PostMapping("/details/{id}/destroy")
|
||||||
@CacheEvict(value = "groups", allEntries = true)
|
@CacheEvict(value = "groups", allEntries = true)
|
||||||
public String postDetailsDestroy(KeycloakAuthenticationToken token,
|
public String postDetailsDestroy(KeycloakAuthenticationToken token,
|
||||||
@RequestParam("group_id") String groupId) {
|
@PathVariable("id") String groupId) {
|
||||||
|
|
||||||
User user = new User(token);
|
User user = new User(token);
|
||||||
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
||||||
@ -119,9 +115,8 @@ public class GroupDetailsController {
|
|||||||
return "redirect:/gruppen2";
|
return "redirect:/gruppen2";
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: /details/{id}/meta
|
|
||||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||||
@GetMapping("/details/meta/{id}")
|
@GetMapping("/details/{id}/meta")
|
||||||
public String getDetailsMeta(KeycloakAuthenticationToken token,
|
public String getDetailsMeta(KeycloakAuthenticationToken token,
|
||||||
Model model,
|
Model model,
|
||||||
@PathVariable("id") String groupId) {
|
@PathVariable("id") String groupId) {
|
||||||
@ -136,14 +131,13 @@ public class GroupDetailsController {
|
|||||||
return "changeMetadata";
|
return "changeMetadata";
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: /details/{id}/meta/update
|
|
||||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||||
@PostMapping("/details/meta")
|
@PostMapping("/details/{id}/meta/update")
|
||||||
@CacheEvict(value = "groups", allEntries = true)
|
@CacheEvict(value = "groups", allEntries = true)
|
||||||
public String postDetailsMetaUpdate(KeycloakAuthenticationToken token,
|
public String postDetailsMetaUpdate(KeycloakAuthenticationToken token,
|
||||||
|
@PathVariable("id") String groupId,
|
||||||
@RequestParam("title") String title,
|
@RequestParam("title") String title,
|
||||||
@RequestParam("description") String description,
|
@RequestParam("description") String description) {
|
||||||
@RequestParam("groupId") String groupId) {
|
|
||||||
|
|
||||||
User user = new User(token);
|
User user = new User(token);
|
||||||
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
||||||
@ -154,9 +148,8 @@ public class GroupDetailsController {
|
|||||||
return "redirect:/gruppen2/details/" + groupId;
|
return "redirect:/gruppen2/details/" + groupId;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: /details/{id}/members
|
|
||||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||||
@GetMapping("/details/members/{id}")
|
@GetMapping("/details/{id}/members")
|
||||||
public String getDetailsMembers(KeycloakAuthenticationToken token,
|
public String getDetailsMembers(KeycloakAuthenticationToken token,
|
||||||
Model model,
|
Model model,
|
||||||
@PathVariable("id") String groupId) {
|
@PathVariable("id") String groupId) {
|
||||||
@ -171,28 +164,26 @@ public class GroupDetailsController {
|
|||||||
return "editMembers";
|
return "editMembers";
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: /details/{id}/members/update/userlimit
|
|
||||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||||
@PostMapping("/details/members/setuserlimit")
|
@PostMapping("/details/{id}/members/update/userlimit")
|
||||||
@CacheEvict(value = "groups", allEntries = true)
|
@CacheEvict(value = "groups", allEntries = true)
|
||||||
public String postDetailsMembersUpdateUserLimit(KeycloakAuthenticationToken token,
|
public String postDetailsMembersUpdateUserLimit(KeycloakAuthenticationToken token,
|
||||||
@RequestParam("maximum") long userLimit,
|
@PathVariable("id") String groupId,
|
||||||
@RequestParam("group_id") String groupId) {
|
@RequestParam("maximum") long userLimit) {
|
||||||
|
|
||||||
User user = new User(token);
|
User user = new User(token);
|
||||||
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
||||||
|
|
||||||
groupService.updateUserLimit(user, group, userLimit);
|
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")
|
@RolesAllowed("ROLE_orga")
|
||||||
@PostMapping("/details/members/csv")
|
@PostMapping("/details/{id}/members/update/csv")
|
||||||
@CacheEvict(value = "groups", allEntries = true)
|
@CacheEvict(value = "groups", allEntries = true)
|
||||||
public String postDetailsMembersUpdateCsv(KeycloakAuthenticationToken token,
|
public String postDetailsMembersUpdateCsv(KeycloakAuthenticationToken token,
|
||||||
@RequestParam("group_id") String groupId,
|
@PathVariable("id") String groupId,
|
||||||
@RequestParam(value = "file", required = false) MultipartFile file) {
|
@RequestParam(value = "file", required = false) MultipartFile file) {
|
||||||
|
|
||||||
User user = new User(token);
|
User user = new User(token);
|
||||||
@ -200,18 +191,17 @@ public class GroupDetailsController {
|
|||||||
|
|
||||||
groupService.addUsersToGroup(CsvService.readCsvFile(file), group, user);
|
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: Method + view for /details/{id}/members/{id}
|
||||||
|
|
||||||
//TODO: /details/{id}/members/{id}/update/role
|
|
||||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||||
@PostMapping("/details/members/togglerole")
|
@PostMapping("/details/{id}/members/{userid}/update/role")
|
||||||
@CacheEvict(value = "groups", allEntries = true)
|
@CacheEvict(value = "groups", allEntries = true)
|
||||||
public String postDetailsMembersUpdateRole(KeycloakAuthenticationToken token,
|
public String postDetailsMembersUpdateRole(KeycloakAuthenticationToken token,
|
||||||
@RequestParam("group_id") String groupId,
|
@PathVariable("id") String groupId,
|
||||||
@RequestParam("user_id") String userId) {
|
@PathVariable("userid") String userId) {
|
||||||
|
|
||||||
User user = new User(token);
|
User user = new User(token);
|
||||||
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
||||||
@ -225,16 +215,15 @@ public class GroupDetailsController {
|
|||||||
return "redirect:/gruppen2/details/" + groupId;
|
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"})
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||||
@PostMapping("/details/members/deleteuser")
|
@PostMapping("/details/{id}/members/{userid}/delete")
|
||||||
@CacheEvict(value = "groups", allEntries = true)
|
@CacheEvict(value = "groups", allEntries = true)
|
||||||
public String postDetailsMembersDelete(KeycloakAuthenticationToken token,
|
public String postDetailsMembersDelete(KeycloakAuthenticationToken token,
|
||||||
@RequestParam("group_id") String groupId,
|
@PathVariable("id") String groupId,
|
||||||
@RequestParam("user_id") String userId) {
|
@PathVariable("userid") String userId) {
|
||||||
|
|
||||||
User user = new User(token);
|
User user = new User(token);
|
||||||
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
Group group = projectionService.projectSingleGroup(UUID.fromString(groupId));
|
||||||
@ -246,6 +235,6 @@ public class GroupDetailsController {
|
|||||||
groupService.deleteUser(new User(userId), group);
|
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.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
@ -38,22 +39,20 @@ public class SearchAndInviteController {
|
|||||||
this.searchService = searchService;
|
this.searchService = searchService;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: /search
|
|
||||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||||
@GetMapping("/searchPage")
|
@GetMapping("/search")
|
||||||
public String getSearchPage(Model model) {
|
public String getSearch(Model model) {
|
||||||
// Noch keine Suche gestartet: leeres Suchergebnis
|
// Noch keine Suche gestartet: leeres Suchergebnis
|
||||||
model.addAttribute("gruppen", Collections.emptyList());
|
model.addAttribute("gruppen", Collections.emptyList());
|
||||||
|
|
||||||
return "search";
|
return "search";
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: /search/{string}
|
|
||||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin"})
|
||||||
@GetMapping("/search")
|
@PostMapping("/search")
|
||||||
public String getSearch(KeycloakAuthenticationToken token,
|
public String postSearch(KeycloakAuthenticationToken token,
|
||||||
Model model,
|
Model model,
|
||||||
@RequestParam("suchbegriff") String search) {
|
@RequestParam("string") String search) {
|
||||||
|
|
||||||
User user = new User(token);
|
User user = new User(token);
|
||||||
List<Group> groups = searchService.searchPublicGroups(search, user);
|
List<Group> groups = searchService.searchPublicGroups(search, user);
|
||||||
|
|||||||
@ -24,13 +24,13 @@
|
|||||||
<a href="/" th:href="@{/gruppen2}">Gruppen</a>
|
<a href="/" th:href="@{/gruppen2}">Gruppen</a>
|
||||||
</li>
|
</li>
|
||||||
<li th:case="${true}">
|
<li th:case="${true}">
|
||||||
<a href="/createOrga" th:href="@{/gruppen2/createOrga}">Erstellen</a>
|
<a href="/create/orga" th:href="@{/gruppen2/create/orga}">Erstellen</a>
|
||||||
</li>
|
</li>
|
||||||
<li th:case="${false}">
|
<li th:case="${false}">
|
||||||
<a href="/createStudent" th:href="@{/gruppen2/createStudent}">Erstellen</a>
|
<a href="/create/student" th:href="@{/gruppen2/create/student}">Erstellen</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/searchPage" th:href="@{/gruppen2/searchPage}">Suche</a>
|
<a href="/search" th:href="@{/gruppen2/search}">Suche</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
@ -40,7 +40,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-10">
|
<div class="col-10">
|
||||||
<h1>Metadaten ändern</h1>
|
<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"
|
<div class="shadow-sm p-2"
|
||||||
style=" border: 10px solid aliceblue; background: aliceblue;">
|
style=" border: 10px solid aliceblue; background: aliceblue;">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@ -58,8 +58,6 @@
|
|||||||
<button class="btn btn-primary"
|
<button class="btn btn-primary"
|
||||||
style="background: #52a1eb; border-style: none;"
|
style="background: #52a1eb; border-style: none;"
|
||||||
th:if="${group.getRoles().get(user.getId()) == admin}"
|
th:if="${group.getRoles().get(user.getId()) == admin}"
|
||||||
th:name="groupId"
|
|
||||||
th:value="${group.getId()}"
|
|
||||||
type="submit">Speichern
|
type="submit">Speichern
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -25,13 +25,13 @@
|
|||||||
<a th:href="@{/gruppen2}" href="/">Gruppen</a>
|
<a th:href="@{/gruppen2}" href="/">Gruppen</a>
|
||||||
</li>
|
</li>
|
||||||
<li th:case="${true}" class="active">
|
<li th:case="${true}" class="active">
|
||||||
<a href="/createOrga" th:href="@{/gruppen2/createOrga}">Erstellen</a>
|
<a href="/create/orga" th:href="@{/gruppen2/create/orga}">Erstellen</a>
|
||||||
</li>
|
</li>
|
||||||
<li th:case="${false}" class="active">
|
<li th:case="${false}" class="active">
|
||||||
<a href="/createStudent" th:href="@{/gruppen2/createStudent}">Erstellen</a>
|
<a href="/create/student" th:href="@{/gruppen2/create/student}">Erstellen</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a th:href="@{/gruppen2/searchPage}" href="/searchPage">Suche</a>
|
<a th:href="@{/gruppen2/search}" href="/search">Suche</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
@ -42,7 +42,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-10">
|
<div class="col-10">
|
||||||
<h1>Gruppenerstellung</h1>
|
<h1>Gruppenerstellung</h1>
|
||||||
<form enctype="multipart/form-data" method="post" th:action="@{/gruppen2/createOrga}">
|
<form enctype="multipart/form-data" method="post" th:action="@{/gruppen2/create/orga}">
|
||||||
<div class="shadow-sm p-2" style=" border: 10px solid aliceblue; background: aliceblue;">
|
<div class="shadow-sm p-2" style=" border: 10px solid aliceblue; background: aliceblue;">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="titel">Titel</label>
|
<label for="titel">Titel</label>
|
||||||
|
|||||||
@ -21,13 +21,13 @@
|
|||||||
<a th:href="@{/gruppen2}" href="/">Gruppen</a>
|
<a th:href="@{/gruppen2}" href="/">Gruppen</a>
|
||||||
</li>
|
</li>
|
||||||
<li th:case="${true}" class="active">
|
<li th:case="${true}" class="active">
|
||||||
<a href="/createOrga" th:href="@{/gruppen2/createOrga}">Erstellen</a>
|
<a href="/create/orga" th:href="@{/gruppen2/create/orga}">Erstellen</a>
|
||||||
</li>
|
</li>
|
||||||
<li th:case="${false}" class="active">
|
<li th:case="${false}" class="active">
|
||||||
<a href="/createStudent" th:href="@{/gruppen2/createStudent}">Erstellen</a>
|
<a href="/create/student" th:href="@{/gruppen2/create/student}">Erstellen</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a th:href="@{/gruppen2/searchPage}" href="/searchPage">Suche</a>
|
<a th:href="@{/gruppen2/search}" href="/search">Suche</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
@ -37,7 +37,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-10">
|
<div class="col-10">
|
||||||
<h1>Gruppenerstellung</h1>
|
<h1>Gruppenerstellung</h1>
|
||||||
<form method="post" th:action="@{/gruppen2/createStudent}">
|
<form method="post" th:action="@{/gruppen2/create/student}">
|
||||||
<div class="shadow-sm p-2"
|
<div class="shadow-sm p-2"
|
||||||
style=" border: 10px solid aliceblue; border-radius: 5px; background: aliceblue;">
|
style=" border: 10px solid aliceblue; border-radius: 5px; background: aliceblue;">
|
||||||
|
|
||||||
|
|||||||
@ -18,13 +18,13 @@
|
|||||||
<a href="/" th:href="@{/gruppen2}">Gruppen</a>
|
<a href="/" th:href="@{/gruppen2}">Gruppen</a>
|
||||||
</li>
|
</li>
|
||||||
<li th:case="${true}">
|
<li th:case="${true}">
|
||||||
<a href="/createOrga" th:href="@{/gruppen2/createOrga}">Erstellen</a>
|
<a href="/create/orga" th:href="@{/gruppen2/create/orga}">Erstellen</a>
|
||||||
</li>
|
</li>
|
||||||
<li th:case="${false}">
|
<li th:case="${false}">
|
||||||
<a href="/createStudent" th:href="@{/gruppen2/createStudent}">Erstellen</a>
|
<a href="/create/student" th:href="@{/gruppen2/create/student}">Erstellen</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/searchPage" th:href="@{/gruppen2/searchPage}">Suche</a>
|
<a href="/search" th:href="@{/gruppen2/search}">Suche</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
@ -42,7 +42,7 @@
|
|||||||
<div class="col-1">
|
<div class="col-1">
|
||||||
<a class="fa fa-pencil"
|
<a class="fa fa-pencil"
|
||||||
style="font-size:30px; width: 5%;"
|
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>
|
th:if="${group.getRoles().get(user.getId()) == admin}"></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -83,15 +83,14 @@
|
|||||||
style="background: #52a1eb; border: none; margin: 5px;">
|
style="background: #52a1eb; border: none; margin: 5px;">
|
||||||
<a style="color: white;" th:href="@{/gruppen2}">Zurück</a>
|
<a style="color: white;" th:href="@{/gruppen2}">Zurück</a>
|
||||||
</button>
|
</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;"
|
<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
|
type="submit">Gruppe verlassen
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<form method="post" th:action="@{/gruppen2/deleteGroup}">
|
<form method="post" th:action="@{/gruppen2/details/{id}/destroy(id=${group.getId()})}">
|
||||||
<button class="btn btn-danger" style="border-style: none; margin: 5px;"
|
<button class="btn btn-danger" style="border-style: none; margin: 5px;" th:name="group_id"
|
||||||
th:name="group_id" th:value="${group.getId()}"
|
|
||||||
th:if="${group.getRoles().get(user.getId()) == admin}"
|
th:if="${group.getRoles().get(user.getId()) == admin}"
|
||||||
type="submit">Gruppe löschen
|
type="submit">Gruppe löschen
|
||||||
</button>
|
</button>
|
||||||
@ -111,7 +110,7 @@
|
|||||||
</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"
|
||||||
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;">
|
<button class="btn btn-secondary" style="background: slategrey; float: left;">
|
||||||
Mitglieder bearbeiten
|
Mitglieder bearbeiten
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@ -16,13 +16,13 @@
|
|||||||
<a th:href="@{/gruppen2}" href="/">Gruppen</a>
|
<a th:href="@{/gruppen2}" href="/">Gruppen</a>
|
||||||
</li>
|
</li>
|
||||||
<li th:case="${true}">
|
<li th:case="${true}">
|
||||||
<a href="/createOrga" th:href="@{/gruppen2/createOrga}">Erstellen</a>
|
<a href="/create/orga" th:href="@{/gruppen2/create/orga}">Erstellen</a>
|
||||||
</li>
|
</li>
|
||||||
<li th:case="${false}">
|
<li th:case="${false}">
|
||||||
<a href="/createStudent" th:href="@{/gruppen2/createStudent}">Erstellen</a>
|
<a href="/create/student" th:href="@{/gruppen2/create/student}">Erstellen</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="active">
|
<li class="active">
|
||||||
<a th:href="@{/gruppen2/searchPage}" href="/searchPage">Suche</a>
|
<a th:href="@{/gruppen2/search}" href="/search">Suche</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
@ -46,6 +46,10 @@
|
|||||||
<p style="overflow-wrap: break-word; font-optical-sizing: auto;"
|
<p style="overflow-wrap: break-word; font-optical-sizing: auto;"
|
||||||
th:text="${group.getDescription()}"></p>
|
th:text="${group.getDescription()}"></p>
|
||||||
</div>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@ -21,13 +21,13 @@
|
|||||||
<a th:href="@{/gruppen2}" href="/">Gruppen</a>
|
<a th:href="@{/gruppen2}" href="/">Gruppen</a>
|
||||||
</li>
|
</li>
|
||||||
<li th:case="${true}">
|
<li th:case="${true}">
|
||||||
<a href="/createOrga" th:href="@{/gruppen2/createOrga}">Erstellen</a>
|
<a href="/create/orga" th:href="@{/gruppen2/create/orga}">Erstellen</a>
|
||||||
</li>
|
</li>
|
||||||
<li th:case="${false}">
|
<li th:case="${false}">
|
||||||
<a href="/createStudent" th:href="@{/gruppen2/createStudent}">Erstellen</a>
|
<a href="/create/student" th:href="@{/gruppen2/create/student}">Erstellen</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a th:href="@{/gruppen2/searchPage}" href="/searchPage">Suche</a>
|
<a th:href="@{/gruppen2/search}" href="/search">Suche</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
@ -49,9 +49,8 @@
|
|||||||
</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')}">
|
||||||
<form th:action="@{/gruppen2/details/members/addUsersFromCsv}"
|
<form th:action="@{/gruppen2/details/{id}/members/update/csv(id=${group.getId()})}"
|
||||||
enctype="multipart/form-data"
|
enctype="multipart/form-data" method="post">
|
||||||
method="post">
|
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3">
|
||||||
<div class="custom-file">
|
<div class="custom-file">
|
||||||
<input class="custom-file-input" id="file" th:name="file"
|
<input class="custom-file-input" id="file" th:name="file"
|
||||||
@ -63,8 +62,7 @@
|
|||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<button class="btn btn-outline-secondary"
|
<button class="btn btn-outline-secondary"
|
||||||
style="background: #52a1eb; border-style: none;"
|
style="background: #52a1eb; border-style: none;"
|
||||||
th:name="group_id" th:value="${group.getId()}"
|
th:name="group_id" type="submit">
|
||||||
type="submit">
|
|
||||||
<a style="color: white;">Hinzufügen</a>
|
<a style="color: white;">Hinzufügen</a>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -72,7 +70,7 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group pt-4">
|
<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">
|
<div class="input-group mb-3" id="userMaximum">
|
||||||
<label for="teilnehmerzahl"></label>
|
<label for="teilnehmerzahl"></label>
|
||||||
<input class="form-control"
|
<input class="form-control"
|
||||||
@ -84,8 +82,7 @@
|
|||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<button class="btn btn-outline-secondary"
|
<button class="btn btn-outline-secondary"
|
||||||
style="background: #52a1eb; border-style: none;"
|
style="background: #52a1eb; border-style: none;"
|
||||||
th:name="group_id" th:value="${group.getId()}"
|
th:name="group_id" type="submit">
|
||||||
type="submit">
|
|
||||||
<a style="color: white;">Speichern</a>
|
<a style="color: white;">Speichern</a>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -111,21 +108,13 @@
|
|||||||
<td>
|
<td>
|
||||||
<div class="text-right btn-toolbar" style="float: right;" role="toolbar">
|
<div class="text-right btn-toolbar" style="float: right;" role="toolbar">
|
||||||
<form method="post"
|
<form method="post"
|
||||||
th:action="@{/gruppen2/details/members/changeRole}">
|
th:action="@{/gruppen2/details/{id}/members/{userid}/update/role(id=${group.getId()}, userid=${member.getId()})}">
|
||||||
<input th:name="group_id" th:value="${group.getId()}"
|
|
||||||
type="hidden">
|
|
||||||
<input th:name="user_id" th:value="${member.getId()}"
|
|
||||||
type="hidden">
|
|
||||||
<button class="btn btn-warning btn-sm" type="submit"
|
<button class="btn btn-warning btn-sm" type="submit"
|
||||||
style="margin: 5px;">Rolle ändern
|
style="margin: 5px;">Rolle ändern
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<form method="post"
|
<form method="post"
|
||||||
th:action="@{/gruppen2/details/members/deleteUser}">
|
th:action="@{/gruppen2/details/{id}/members/{userid}/delete(id=${group.getId()}, userid=${member.getId()})}">
|
||||||
<input th:name="group_id" th:value="${group.getId()}"
|
|
||||||
type="hidden">
|
|
||||||
<input th:name="user_id" th:value="${member.getId()}"
|
|
||||||
type="hidden">
|
|
||||||
<button class="btn btn-danger btn-sm" style="margin: 5px;"
|
<button class="btn btn-danger btn-sm" style="margin: 5px;"
|
||||||
th:if='!${account.getName().equals(member.getId())}'>
|
th:if='!${account.getName().equals(member.getId())}'>
|
||||||
Mitglied entfernen
|
Mitglied entfernen
|
||||||
|
|||||||
@ -17,13 +17,13 @@
|
|||||||
<a href="/" th:href="@{/gruppen2}">Gruppen</a>
|
<a href="/" th:href="@{/gruppen2}">Gruppen</a>
|
||||||
</li>
|
</li>
|
||||||
<li th:case="${true}">
|
<li th:case="${true}">
|
||||||
<a href="/createOrga" th:href="@{/gruppen2/createOrga}">Erstellen</a>
|
<a href="/create/orga" th:href="@{/gruppen2/create/orga}">Erstellen</a>
|
||||||
</li>
|
</li>
|
||||||
<li th:case="${false}">
|
<li th:case="${false}">
|
||||||
<a href="/createStudent" th:href="@{/gruppen2/createStudent}">Erstellen</a>
|
<a href="/create/student" th:href="@{/gruppen2/create/student}">Erstellen</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/searchPage" th:href="@{/gruppen2/searchPage}">Suche</a>
|
<a href="/search" th:href="@{/gruppen2/search}">Suche</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@ -19,13 +19,13 @@
|
|||||||
<a href="/" th:href="@{/gruppen2}">Gruppen</a>
|
<a href="/" th:href="@{/gruppen2}">Gruppen</a>
|
||||||
</li>
|
</li>
|
||||||
<li th:case="${true}">
|
<li th:case="${true}">
|
||||||
<a href="/createOrga" th:href="@{/gruppen2/createOrga}">Erstellen</a>
|
<a href="/create/orga" th:href="@{/gruppen2/create/orga}">Erstellen</a>
|
||||||
</li>
|
</li>
|
||||||
<li th:case="${false}">
|
<li th:case="${false}">
|
||||||
<a href="/createStudent" th:href="@{/gruppen2/createStudent}">Erstellen</a>
|
<a href="/create/student" th:href="@{/gruppen2/create/student}">Erstellen</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="active">
|
<li class="active">
|
||||||
<a href="/searchPage" th:href="@{/gruppen2/searchPage}">Suche</a>
|
<a href="/search" th:href="@{/gruppen2/search}">Suche</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
@ -44,7 +44,7 @@
|
|||||||
<div class="form-group mt-2" th:if="${group.getMembers().size() < group.getUserLimit()}">
|
<div class="form-group mt-2" th:if="${group.getMembers().size() < group.getUserLimit()}">
|
||||||
<h3>Möchtest du dieser privaten Gruppe beitreten?</h3>
|
<h3>Möchtest du dieser privaten Gruppe beitreten?</h3>
|
||||||
<div class="text-right">
|
<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"/>
|
<input name="id" th:value="${group.getId()}" type="hidden"/>
|
||||||
<button class="btn btn-primary"
|
<button class="btn btn-primary"
|
||||||
style="background: #52a1eb; border-style: none;"
|
style="background: #52a1eb; border-style: none;"
|
||||||
|
|||||||
@ -17,13 +17,13 @@
|
|||||||
<a th:href="@{/gruppen2}" href="/">Gruppen</a>
|
<a th:href="@{/gruppen2}" href="/">Gruppen</a>
|
||||||
</li>
|
</li>
|
||||||
<li th:case="${true}">
|
<li th:case="${true}">
|
||||||
<a href="/createOrga" th:href="@{/gruppen2/createOrga}">Erstellen</a>
|
<a href="/create/orga" th:href="@{/gruppen2/create/orga}">Erstellen</a>
|
||||||
</li>
|
</li>
|
||||||
<li th:case="${false}">
|
<li th:case="${false}">
|
||||||
<a href="/createStudent" th:href="@{/gruppen2/createStudent}">Erstellen</a>
|
<a href="/create/student" th:href="@{/gruppen2/create/student}">Erstellen</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="active">
|
<li class="active">
|
||||||
<a th:href="@{/gruppen2/searchPage}" href="/searchPage">Suche</a>
|
<a th:href="@{/gruppen2/search}" href="/search">Suche</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
@ -35,20 +35,15 @@
|
|||||||
<h1>Gruppensuche</h1>
|
<h1>Gruppensuche</h1>
|
||||||
<div class="shadow-sm p-2"
|
<div class="shadow-sm p-2"
|
||||||
style="border: 10px solid aliceblue; border-radius: 5px; background: aliceblue;">
|
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">
|
<div class="form-group">
|
||||||
<label for="suchleiste">Suchbegriff:</label>
|
<label for="suchleiste">Suchbegriff:</label>
|
||||||
<input class="form-control" id="suchleiste"
|
<input class="form-control" id="suchleiste"
|
||||||
placeholder="z.B. Programmieren, Lerngruppe, ..."
|
placeholder="z.B. Programmieren, Lerngruppe, ..."
|
||||||
th:name="suchbegriff" type="text">
|
th:name="string" type="text">
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-primary"
|
<button class="btn btn-primary" style="background: #52a1eb; border-style: none;" type="submit">
|
||||||
style="background: #52a1eb; border-style: none;"
|
Suchen
|
||||||
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>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -53,10 +53,10 @@ class APIControllerTest {
|
|||||||
@Test
|
@Test
|
||||||
@WithMockUser(username = "api_user", roles = "api_user")
|
@WithMockUser(username = "api_user", roles = "api_user")
|
||||||
void updateGroup_noGroup() {
|
void updateGroup_noGroup() {
|
||||||
assertThat(apiController.update(0L).getGroupList()).hasSize(0);
|
assertThat(apiController.getApiUpdate(0L).getGroupList()).hasSize(0);
|
||||||
assertThat(apiController.update(4L).getGroupList()).hasSize(0);
|
assertThat(apiController.getApiUpdate(4L).getGroupList()).hasSize(0);
|
||||||
assertThat(apiController.update(10L).getGroupList()).hasSize(0);
|
assertThat(apiController.getApiUpdate(10L).getGroupList()).hasSize(0);
|
||||||
assertThat(apiController.update(0L).getStatus()).isEqualTo(0);
|
assertThat(apiController.getApiUpdate(0L).getStatus()).isEqualTo(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -69,10 +69,10 @@ class APIControllerTest {
|
|||||||
addUserEvent(uuidMock(0)),
|
addUserEvent(uuidMock(0)),
|
||||||
addUserEvent(uuidMock(0)));
|
addUserEvent(uuidMock(0)));
|
||||||
|
|
||||||
assertThat(apiController.update(0L).getGroupList()).hasSize(1);
|
assertThat(apiController.getApiUpdate(0L).getGroupList()).hasSize(1);
|
||||||
assertThat(apiController.update(4L).getGroupList()).hasSize(1);
|
assertThat(apiController.getApiUpdate(4L).getGroupList()).hasSize(1);
|
||||||
assertThat(apiController.update(10L).getGroupList()).hasSize(0);
|
assertThat(apiController.getApiUpdate(10L).getGroupList()).hasSize(0);
|
||||||
assertThat(apiController.update(0L).getStatus()).isEqualTo(6);
|
assertThat(apiController.getApiUpdate(0L).getStatus()).isEqualTo(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -89,17 +89,17 @@ class APIControllerTest {
|
|||||||
addUserEvent(uuidMock(1)),
|
addUserEvent(uuidMock(1)),
|
||||||
addUserEvent(uuidMock(1)));
|
addUserEvent(uuidMock(1)));
|
||||||
|
|
||||||
assertThat(apiController.update(0L).getGroupList()).hasSize(2);
|
assertThat(apiController.getApiUpdate(0L).getGroupList()).hasSize(2);
|
||||||
assertThat(apiController.update(4L).getGroupList()).hasSize(1);
|
assertThat(apiController.getApiUpdate(4L).getGroupList()).hasSize(1);
|
||||||
assertThat(apiController.update(6L).getGroupList()).hasSize(1);
|
assertThat(apiController.getApiUpdate(6L).getGroupList()).hasSize(1);
|
||||||
assertThat(apiController.update(7L).getGroupList()).hasSize(1);
|
assertThat(apiController.getApiUpdate(7L).getGroupList()).hasSize(1);
|
||||||
assertThat(apiController.update(0L).getStatus()).isEqualTo(9);
|
assertThat(apiController.getApiUpdate(0L).getStatus()).isEqualTo(9);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@WithMockUser(username = "api_user", roles = "api_user")
|
@WithMockUser(username = "api_user", roles = "api_user")
|
||||||
void getGroupsOfUser_noGroup() {
|
void getGroupsOfUser_noGroup() {
|
||||||
assertThat(apiController.usergroups("A")).isEmpty();
|
assertThat(apiController.getApiUserGroups("A")).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -110,7 +110,7 @@ class APIControllerTest {
|
|||||||
createPrivateGroupEvent(uuidMock(2)),
|
createPrivateGroupEvent(uuidMock(2)),
|
||||||
addUserEvent(uuidMock(0), "A"));
|
addUserEvent(uuidMock(0), "A"));
|
||||||
|
|
||||||
assertThat(apiController.usergroups("A")).hasSize(1);
|
assertThat(apiController.getApiUserGroups("A")).hasSize(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -120,7 +120,7 @@ class APIControllerTest {
|
|||||||
addUserEvent(uuidMock(0), "A"),
|
addUserEvent(uuidMock(0), "A"),
|
||||||
deleteUserEvent(uuidMock(0), "A"));
|
deleteUserEvent(uuidMock(0), "A"));
|
||||||
|
|
||||||
assertThat(apiController.usergroups("A")).isEmpty();
|
assertThat(apiController.getApiUserGroups("A")).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Disabled
|
@Disabled
|
||||||
@ -131,7 +131,7 @@ class APIControllerTest {
|
|||||||
addUserEvent(uuidMock(0), "A"),
|
addUserEvent(uuidMock(0), "A"),
|
||||||
deleteGroupEvent(uuidMock(0)));
|
deleteGroupEvent(uuidMock(0)));
|
||||||
|
|
||||||
assertThat(apiController.usergroups("A")).isEmpty();
|
assertThat(apiController.getApiUserGroups("A")).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -146,14 +146,14 @@ class APIControllerTest {
|
|||||||
addUserEvent(uuidMock(2), "A"),
|
addUserEvent(uuidMock(2), "A"),
|
||||||
addUserEvent(uuidMock(2), "B"));
|
addUserEvent(uuidMock(2), "B"));
|
||||||
|
|
||||||
assertThat(apiController.usergroups("A")).hasSize(3);
|
assertThat(apiController.getApiUserGroups("A")).hasSize(3);
|
||||||
assertThat(apiController.usergroups("B")).hasSize(2);
|
assertThat(apiController.getApiUserGroups("B")).hasSize(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@WithMockUser(username = "api_user", roles = "api_user")
|
@WithMockUser(username = "api_user", roles = "api_user")
|
||||||
void getGroupFromId_noGroup() {
|
void getGroupFromId_noGroup() {
|
||||||
assertThrows(GroupNotFoundException.class, () -> apiController.getGroupById(uuidMock(0).toString()));
|
assertThrows(GroupNotFoundException.class, () -> apiController.getApiGroup(uuidMock(0).toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -161,7 +161,7 @@ class APIControllerTest {
|
|||||||
void getGroupFromId_singleGroup() {
|
void getGroupFromId_singleGroup() {
|
||||||
eventStoreService.saveAll(createPrivateGroupEvent(uuidMock(0)));
|
eventStoreService.saveAll(createPrivateGroupEvent(uuidMock(0)));
|
||||||
|
|
||||||
assertThat(apiController.getGroupById(uuidMock(0).toString()).getId()).isEqualTo(uuidMock(0));
|
assertThat(apiController.getApiGroup(uuidMock(0).toString()).getId()).isEqualTo(uuidMock(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -171,6 +171,6 @@ class APIControllerTest {
|
|||||||
updateGroupTitleEvent(uuidMock(0)),
|
updateGroupTitleEvent(uuidMock(0)),
|
||||||
deleteGroupEvent(uuidMock(0)));
|
deleteGroupEvent(uuidMock(0)));
|
||||||
|
|
||||||
assertThat(apiController.getGroupById(uuidMock(0).toString()).getTitle()).isEqualTo(null);
|
assertThat(apiController.getApiGroup(uuidMock(0).toString()).getTitle()).isEqualTo(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user