1

added @Secured and fixed

Co-authored-by: LukasEttel <lukas.ettie@yahoo.de>
Co-authored-by: AndiBuls <andreas.buls@uni-duesseldorf.de>
This commit is contained in:
[Mahgs]
2020-03-16 15:40:46 +01:00
parent 3f144d14e4
commit e12f0c1d59
2 changed files with 4 additions and 5 deletions

View File

@ -44,12 +44,15 @@ public class APIController {
} }
@GetMapping("/getGroupIdsOfUser/{teilnehmer}") @GetMapping("/getGroupIdsOfUser/{teilnehmer}")
@Secured("ROLE_api_user")
@ApiOperation(value = "Gibt alle Gruppen zurück in denen sich ein Teilnehmer befindet") @ApiOperation(value = "Gibt alle Gruppen zurück in denen sich ein Teilnehmer befindet")
public List<Long> getGroupsOfUser(@ApiParam("Teilnehmer dessen groupIds zurückgegeben werden sollen") @PathVariable String teilnehmer) throws EventException { public List<Long> getGroupsOfUser(@ApiParam("Teilnehmer dessen groupIds zurückgegeben werden sollen") @PathVariable String teilnehmer) throws EventException {
return eventService.getGroupsOfUser(teilnehmer); return eventService.getGroupsOfUser(teilnehmer);
} }
@GetMapping("/getGroup/{groupId}") @GetMapping("/getGroup/{groupId}")
@Secured("ROLE_api_user")
@ApiOperation(value = "Gibt die Gruppe mit der als Parameter mitgegebenden groupId zurück") @ApiOperation(value = "Gibt die Gruppe mit der als Parameter mitgegebenden groupId zurück")
public Group getGroupFromId(@ApiParam("GruppenId der gefordeten Gruppe") @PathVariable Long groupId) throws EventException{ public Group getGroupFromId(@ApiParam("GruppenId der gefordeten Gruppe") @PathVariable Long groupId) throws EventException{
List<Event> eventList = eventService.getEventsOfGroup(groupId); List<Event> eventList = eventService.getEventsOfGroup(groupId);

View File

@ -3,8 +3,7 @@ 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.GroupType;
import mops.gruppen2.domain.Role;
import mops.gruppen2.domain.User; import mops.gruppen2.domain.User;
import mops.gruppen2.security.Account; import mops.gruppen2.security.Account;
import mops.gruppen2.service.*; import mops.gruppen2.service.*;
@ -20,7 +19,6 @@ import org.springframework.web.server.ResponseStatusException;
import javax.annotation.security.RolesAllowed; import javax.annotation.security.RolesAllowed;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
@Controller @Controller
@RequestMapping("/gruppen2") @RequestMapping("/gruppen2")
@ -28,8 +26,6 @@ public class Gruppen2Controller {
@Autowired @Autowired
Gruppen2Config gruppen2Config; Gruppen2Config gruppen2Config;
@Autowired
RestTemplate serviceAccountRestTemplate;
private final KeyCloakService keyCloakService; private final KeyCloakService keyCloakService;
private final EventService eventService; private final EventService eventService;