changed repoId to id

This commit is contained in:
Konstantinos Spyrou 2021-07-12 11:51:10 +00:00
parent e0c193f86b
commit 301e680136
1 changed files with 15 additions and 15 deletions

View File

@ -192,13 +192,13 @@ public class RepositoryController {
@RequestMapping(value = "/addInterface", method = RequestMethod.POST, @RequestMapping(value = "/addInterface", method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_VALUE) consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody @ResponseBody
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#repoId)") @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#id)")
public RepositoryInterface addRepositoryInterface(@RequestParam("datatype") String datatype, public RepositoryInterface addRepositoryInterface(@RequestParam("datatype") String datatype,
@RequestParam("repoId") String repoId, @RequestParam("id") String id,
@RequestParam("registeredBy") String registeredBy, @RequestParam("registeredBy") String registeredBy,
@RequestParam(value = "comment", required = false) String comment, @RequestParam(value = "comment", required = false) String comment,
@RequestBody RepositoryInterface repositoryInterface) throws Exception { @RequestBody RepositoryInterface repositoryInterface) throws Exception {
return repositoryService.addRepositoryInterface(datatype, repoId, registeredBy, comment, repositoryInterface); return repositoryService.addRepositoryInterface(datatype, id, registeredBy, comment, repositoryInterface);
} }
@RequestMapping(value = "/getUrlsOfUserRepos/{page}/{size}/", method = RequestMethod.GET, @RequestMapping(value = "/getUrlsOfUserRepos/{page}/{size}/", method = RequestMethod.GET,
@ -231,11 +231,11 @@ public class RepositoryController {
return repositoryService.getDatasourceClasses(mode); return repositoryService.getDatasourceClasses(mode);
} }
@RequestMapping(value = "/getMetricsInfoForRepository/{repoId}", method = RequestMethod.GET, @RequestMapping(value = "/getMetricsInfoForRepository/{id}", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE) produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody @ResponseBody
public MetricsInfo getMetricsInfoForRepository(@PathVariable("repoId") String repoId) throws RepositoryServiceException { public MetricsInfo getMetricsInfoForRepository(@PathVariable("id") String id) throws RepositoryServiceException {
return repositoryService.getMetricsInfoForRepository(repoId); return repositoryService.getMetricsInfoForRepository(id);
} }
@RequestMapping(value = "/getListLatestUpdate/{mode}", method = RequestMethod.GET, @RequestMapping(value = "/getListLatestUpdate/{mode}", method = RequestMethod.GET,
@ -248,12 +248,12 @@ public class RepositoryController {
@RequestMapping(value = "/updateRepositoryInterface", method = RequestMethod.POST, @RequestMapping(value = "/updateRepositoryInterface", method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_VALUE) consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody @ResponseBody
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#repoId)") @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#id)")
public RepositoryInterface updateRepositoryInterface(@RequestParam("repoId") String repoId, public RepositoryInterface updateRepositoryInterface(@RequestParam("id") String id,
@RequestParam("registeredBy") String registeredBy, @RequestParam("registeredBy") String registeredBy,
@RequestParam(value = "comment", required = false) String comment, @RequestParam(value = "comment", required = false) String comment,
@RequestBody RepositoryInterface repositoryInterface) throws Exception { @RequestBody RepositoryInterface repositoryInterface) throws Exception {
return repositoryService.updateRepositoryInterface(repoId, registeredBy, comment, repositoryInterface); return repositoryService.updateRepositoryInterface(id, registeredBy, comment, repositoryInterface);
} }
@ -263,18 +263,18 @@ public class RepositoryController {
/** /**
* Get all the admins of the repository * Get all the admins of the repository
*/ */
@RequestMapping(method = RequestMethod.GET, path = "{repoId}/admins") @RequestMapping(method = RequestMethod.GET, path = "{id}/admins")
@PreAuthorize("hasAnyAuthority('ROLE_ADMIN', 'ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#id)") @PreAuthorize("hasAnyAuthority('ROLE_ADMIN', 'ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#id)")
public ResponseEntity<List<User>> getAdminsOfARepo(@PathVariable("repoId") String id) { public ResponseEntity<List<User>> getAdminsOfARepo(@PathVariable("id") String id) {
return new ResponseEntity<>(authorizationService.getAdminsOfRepo(id), HttpStatus.OK); return new ResponseEntity<>(authorizationService.getAdminsOfRepo(id), HttpStatus.OK);
} }
/** /**
* Subscribe to repo by email * Subscribe to repo by email
*/ */
@RequestMapping(method = RequestMethod.POST, path = "{repoId}/admins") @RequestMapping(method = RequestMethod.POST, path = "{id}/admins")
@PreAuthorize("hasAnyAuthority('ROLE_ADMIN', 'ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#id)") @PreAuthorize("hasAnyAuthority('ROLE_ADMIN', 'ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#id)")
public Response subscribeByEmail(@PathVariable("repoId") String id, @RequestBody String email) throws ResourceNotFoundException { public Response subscribeByEmail(@PathVariable("id") String id, @RequestBody String email) throws ResourceNotFoundException {
authorizationService.addAdmin(id, email); authorizationService.addAdmin(id, email);
return Response.status(HttpStatus.OK.value()).entity(JsonUtils.createResponse("Role has been assigned").toString()).type(javax.ws.rs.core.MediaType.APPLICATION_JSON).build(); return Response.status(HttpStatus.OK.value()).entity(JsonUtils.createResponse("Role has been assigned").toString()).type(javax.ws.rs.core.MediaType.APPLICATION_JSON).build();
} }
@ -282,9 +282,9 @@ public class RepositoryController {
/** /**
* Unsubscribe from repo by email * Unsubscribe from repo by email
*/ */
@RequestMapping(method = RequestMethod.DELETE, path = "{repoId}/admins/{email}") @RequestMapping(method = RequestMethod.DELETE, path = "{id}/admins/{email}")
@PreAuthorize("hasAnyAuthority('ROLE_ADMIN', 'ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#id)") @PreAuthorize("hasAnyAuthority('ROLE_ADMIN', 'ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#id)")
public Response unsubscribeByEmail(@PathVariable("id") String id, @RequestBody String email) throws ResourceNotFoundException { public Response unsubscribeByEmail(@PathVariable("id") String id, @PathVariable("email") String email) throws ResourceNotFoundException {
authorizationService.removeAdmin(id, email); authorizationService.removeAdmin(id, email);
return Response.status(HttpStatus.OK.value()).entity(JsonUtils.createResponse("Role has been removed").toString()).type(javax.ws.rs.core.MediaType.APPLICATION_JSON).build(); return Response.status(HttpStatus.OK.value()).entity(JsonUtils.createResponse("Role has been removed").toString()).type(javax.ws.rs.core.MediaType.APPLICATION_JSON).build();
} }