Project

General

Profile

« Previous | Next » 

Revision 60586

[User | Trunk]: Add methods to get ids of managers and members for an entity.

View differences:

RegistryService.java
493 493
    }
494 494

  
495 495
    /**
496
     * Get the Identifiers of the members of a type(Community, etc.) with id(ee, egi, etc.)
497
     */
498
    @Path("/{type}/{id}/members/id")
499
    @GET
500
    @Produces(MediaType.APPLICATION_JSON)
501
    @PreAuthorize("hasAnyAuthority(@AuthorizationService.PORTAL_ADMIN," +
502
            "@AuthorizationService.curator(#type), @AuthorizationService.manager(#type, #id))")
503
    public Response getMembersId(@PathParam("type") String type, @PathParam("id") String id) {
504
        Integer couId = calls.getCouId(type, id, false);
505
        if(couId != null) {
506
            JsonArray members = calls.getUserIdByCouId(couId, false);
507
            return Response.status(HttpStatus.OK.value()).entity(jsonUtils.createResponse(members).toString()).type(MediaType.APPLICATION_JSON).build();
508
        } else {
509
            return Response.status(HttpStatus.NOT_FOUND.value()).entity(jsonUtils.createResponse("Role has not been found").toString()).type(MediaType.APPLICATION_JSON).build();
510
        }
511
    }
512

  
513
    /**
496 514
     * Get the number of the members of a type(Community, etc.) with id(ee, egi, etc.)
497 515
     */
498 516
    @Path("/{type}/{id}/members/count")
......
538 556
            return Response.status(HttpStatus.NOT_FOUND.value()).entity(jsonUtils.createResponse("Role has not been found").toString()).type(MediaType.APPLICATION_JSON).build();
539 557
        }
540 558
    }
559

  
560
    /**
561
     * Get the Identifiers of the managers of a type(Community, etc.) with id(ee, egi, etc.)
562
     */
563
    @Path("/{type}/{id}/managers/id")
564
    @GET
565
    @Produces(MediaType.APPLICATION_JSON)
566
    public Response getManagersId(@PathParam("type") String type, @PathParam("id") String id) {
567
        Integer couId = calls.getCouId(type, id);
568
        if(couId != null) {
569
            JsonArray managers = calls.getUserIdByCouId(couId, true);
570
            return Response.status(HttpStatus.OK.value()).entity(jsonUtils.createResponse(managers).toString()).type(MediaType.APPLICATION_JSON).build();
571
        } else {
572
            return Response.status(HttpStatus.NOT_FOUND.value()).entity(jsonUtils.createResponse("Role has not been found").toString()).type(MediaType.APPLICATION_JSON).build();
573
        }
574
    }
541 575
}

Also available in: Unified diff