fixed authorization for deleteInterface

This commit is contained in:
Antonis Lempesis 2021-10-21 12:57:02 +00:00
parent 010f5dd499
commit d834aaf261
1 changed files with 12 additions and 13 deletions

View File

@ -169,7 +169,7 @@ public class RepositoryController {
} }
@RequestMapping(value = "/deleteInterface/", method = RequestMethod.DELETE) @RequestMapping(value = "/deleteInterface/", method = RequestMethod.DELETE)
@PreAuthorize("@authorizationService.isMemberOf(#id)") @PreAuthorize("hasAuthority('SUPER_ADMINISTRATOR') or hasAuthority('CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR') or @authorizationService.isMemberOf(#id)")
public void deleteRepositoryInterface(@RequestParam("id") String id, public void deleteRepositoryInterface(@RequestParam("id") String id,
@RequestParam("registeredBy") String registeredBy) { @RequestParam("registeredBy") String registeredBy) {
repositoryService.deleteRepositoryInterface(id, registeredBy); repositoryService.deleteRepositoryInterface(id, registeredBy);
@ -187,6 +187,17 @@ public class RepositoryController {
return repositoryService.addRepositoryInterface(datatype, id, registeredBy, comment, repositoryInterface); return repositoryService.addRepositoryInterface(datatype, id, registeredBy, comment, repositoryInterface);
} }
@RequestMapping(value = "/updateRepositoryInterface", method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasAuthority('SUPER_ADMINISTRATOR') or hasAuthority('CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR') or @authorizationService.isMemberOf(#id)")
public RepositoryInterface updateRepositoryInterface(@RequestParam("repoId") String id,
@RequestParam("registeredBy") String registeredBy,
@RequestParam(value = "comment", required = false) String comment,
@RequestBody RepositoryInterface repositoryInterface) throws Exception {
return repositoryService.updateRepositoryInterface(id, registeredBy, comment, repositoryInterface);
}
@RequestMapping(value = "/getUrlsOfUserRepos/{page}/{size}/", method = RequestMethod.GET, @RequestMapping(value = "/getUrlsOfUserRepos/{page}/{size}/", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE) produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody @ResponseBody
@ -231,18 +242,6 @@ public class RepositoryController {
return repositoryService.getListLatestUpdate(mode); return repositoryService.getListLatestUpdate(mode);
} }
@RequestMapping(value = "/updateRepositoryInterface", method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasAuthority('SUPER_ADMINISTRATOR') or hasAuthority('CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR') or @authorizationService.isMemberOf(#id)")
public RepositoryInterface updateRepositoryInterface(@RequestParam("repoId") String id,
@RequestParam("registeredBy") String registeredBy,
@RequestParam(value = "comment", required = false) String comment,
@RequestBody RepositoryInterface repositoryInterface) throws Exception {
return repositoryService.updateRepositoryInterface(id, registeredBy, comment, repositoryInterface);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////