Project

General

Profile

« Previous | Next » 

Revision 61364

changed repoId to id

View differences:

modules/uoa-repository-manager-service/branches/aai_roles_new/src/main/java/eu/dnetlib/repo/manager/controllers/RepositoryController.java
192 192
    @RequestMapping(value = "/addInterface", method = RequestMethod.POST,
193 193
            consumes = MediaType.APPLICATION_JSON_VALUE)
194 194
    @ResponseBody
195
    @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#repoId)")
195
    @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#id)")
196 196
    public RepositoryInterface addRepositoryInterface(@RequestParam("datatype") String datatype,
197
                                                      @RequestParam("repoId") String repoId,
197
                                                      @RequestParam("id") String id,
198 198
                                                      @RequestParam("registeredBy") String registeredBy,
199 199
                                                      @RequestParam(value = "comment", required = false) String comment,
200 200
                                                      @RequestBody RepositoryInterface repositoryInterface) throws Exception {
201
        return repositoryService.addRepositoryInterface(datatype, repoId, registeredBy, comment, repositoryInterface);
201
        return repositoryService.addRepositoryInterface(datatype, id, registeredBy, comment, repositoryInterface);
202 202
    }
203 203

  
204 204
    @RequestMapping(value = "/getUrlsOfUserRepos/{page}/{size}/", method = RequestMethod.GET,
......
231 231
        return repositoryService.getDatasourceClasses(mode);
232 232
    }
233 233

  
234
    @RequestMapping(value = "/getMetricsInfoForRepository/{repoId}", method = RequestMethod.GET,
234
    @RequestMapping(value = "/getMetricsInfoForRepository/{id}", method = RequestMethod.GET,
235 235
            produces = MediaType.APPLICATION_JSON_VALUE)
236 236
    @ResponseBody
237
    public MetricsInfo getMetricsInfoForRepository(@PathVariable("repoId") String repoId) throws RepositoryServiceException {
238
        return repositoryService.getMetricsInfoForRepository(repoId);
237
    public MetricsInfo getMetricsInfoForRepository(@PathVariable("id") String id) throws RepositoryServiceException {
238
        return repositoryService.getMetricsInfoForRepository(id);
239 239
    }
240 240

  
241 241
    @RequestMapping(value = "/getListLatestUpdate/{mode}", method = RequestMethod.GET,
......
248 248
    @RequestMapping(value = "/updateRepositoryInterface", method = RequestMethod.POST,
249 249
            consumes = MediaType.APPLICATION_JSON_VALUE)
250 250
    @ResponseBody
251
    @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#repoId)")
252
    public RepositoryInterface updateRepositoryInterface(@RequestParam("repoId") String repoId,
251
    @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#id)")
252
    public RepositoryInterface updateRepositoryInterface(@RequestParam("id") String id,
253 253
                                                         @RequestParam("registeredBy") String registeredBy,
254 254
                                                         @RequestParam(value = "comment", required = false) String comment,
255 255
                                                         @RequestBody RepositoryInterface repositoryInterface) throws Exception {
256
        return repositoryService.updateRepositoryInterface(repoId, registeredBy, comment, repositoryInterface);
256
        return repositoryService.updateRepositoryInterface(id, registeredBy, comment, repositoryInterface);
257 257
    }
258 258

  
259 259

  
......
263 263
    /**
264 264
     * Get all the admins of the repository
265 265
     */
266
    @RequestMapping(method = RequestMethod.GET, path = "{repoId}/admins")
266
    @RequestMapping(method = RequestMethod.GET, path = "{id}/admins")
267 267
    @PreAuthorize("hasAnyAuthority('ROLE_ADMIN', 'ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#id)")
268
    public ResponseEntity<List<User>> getAdminsOfARepo(@PathVariable("repoId") String id) {
268
    public ResponseEntity<List<User>> getAdminsOfARepo(@PathVariable("id") String id) {
269 269
        return new ResponseEntity<>(authorizationService.getAdminsOfRepo(id), HttpStatus.OK);
270 270
    }
271 271

  
272 272
    /**
273 273
     * Subscribe to repo by email
274 274
     */
275
    @RequestMapping(method = RequestMethod.POST, path = "{repoId}/admins")
275
    @RequestMapping(method = RequestMethod.POST, path = "{id}/admins")
276 276
    @PreAuthorize("hasAnyAuthority('ROLE_ADMIN', 'ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#id)")
277
    public Response subscribeByEmail(@PathVariable("repoId") String id, @RequestBody String email) throws ResourceNotFoundException {
277
    public Response subscribeByEmail(@PathVariable("id") String id, @RequestBody String email) throws ResourceNotFoundException {
278 278
        authorizationService.addAdmin(id, email);
279 279
        return Response.status(HttpStatus.OK.value()).entity(JsonUtils.createResponse("Role has been assigned").toString()).type(javax.ws.rs.core.MediaType.APPLICATION_JSON).build();
280 280
    }
......
282 282
    /**
283 283
     * Unsubscribe from repo by email
284 284
     */
285
    @RequestMapping(method = RequestMethod.DELETE, path = "{repoId}/admins/{email}")
285
    @RequestMapping(method = RequestMethod.DELETE, path = "{id}/admins/{email}")
286 286
    @PreAuthorize("hasAnyAuthority('ROLE_ADMIN', 'ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#id)")
287
    public Response unsubscribeByEmail(@PathVariable("id") String id, @RequestBody String email) throws ResourceNotFoundException {
287
    public Response unsubscribeByEmail(@PathVariable("id") String id, @PathVariable("email") String email) throws ResourceNotFoundException {
288 288
        authorizationService.removeAdmin(id, email);
289 289
        return Response.status(HttpStatus.OK.value()).entity(JsonUtils.createResponse("Role has been removed").toString()).type(javax.ws.rs.core.MediaType.APPLICATION_JSON).build();
290 290
    }

Also available in: Unified diff