Project

General

Profile

« Previous | Next » 

Revision 60483

merging trunk changes

View differences:

RegistryService.java
120 120
    @Consumes(MediaType.APPLICATION_JSON)
121 121
    @PreAuthorize("hasAnyAuthority(@AuthorizationService.PORTAL_ADMIN)")
122 122
    public Response createRole(@RequestBody Role role) {
123
        if(calls.getCouId(role.getName()) == null) {
123 124
        calls.createRole(role);
124 125
        return Response.status(HttpStatus.OK.value()).entity(jsonUtils.createResponse("Role has been created").toString()).type(MediaType.APPLICATION_JSON).build();
126
        } else {
127
            return Response.status(HttpStatus.CONFLICT.value()).entity(jsonUtils.createResponse("Role has already existed").toString()).type(MediaType.APPLICATION_JSON).build();
128
        }
125 129
    }
126 130

  
127 131
    /**
......
162 166
    @PreAuthorize("hasAnyAuthority(@AuthorizationService.PORTAL_ADMIN, " +
163 167
            "@AuthorizationService.curator(#type), @AuthorizationService.manager(#type, #id))")
164 168
    public Response inviteMember(@PathParam("type") String type, @PathParam("id") String id, @RequestBody String body) {
165
        Integer couId = calls.getCouId(type, id);
169
        Integer couId = calls.getCouId(type, id, false);
166 170
        if (couId != null) {
167 171
            JsonObject details = new JsonParser().parse(body).getAsJsonObject();
168 172
            JsonObject email = details.get("email").getAsJsonObject();
......
224 228
    @PreAuthorize("hasAnyAuthority(@AuthorizationService.PORTAL_ADMIN, " +
225 229
            "@AuthorizationService.curator(#type), @AuthorizationService.manager(#type, #id))")
226 230
    public Response cancelMemberInvitations(@PathParam("type") String type, @PathParam("id") String id, @PathParam("email") String email) {
227
        Integer couId = calls.getCouId(type, id);
231
        Integer couId = calls.getCouId(type, id, false);
228 232
        if (couId != null) {
229 233
            verificationUtils.deleteMemberVerifications(email, type, id);
230 234
            return Response.status(HttpStatus.OK.value()).entity(jsonUtils.createResponse("Invitations have been deleted").toString()).type(MediaType.APPLICATION_JSON).build();
......
360 364
            if (coPersonId != null) {
361 365
                if (coPersonId.equals(calls.getCoPersonIdByIdentifier())) {
362 366
                    if (verification.getVerificationCode().equals(code)) {
363
                        Integer couId = calls.getCouId(verification.getType(), verification.getEntity());
367
                        Integer couId = calls.getCouId(verification.getType(), verification.getEntity(), false);
364 368
                        if (couId != null) {
365 369
                            Integer role = calls.getRoleId(coPersonId, couId);
366 370
                            calls.assignMemberRole(coPersonId, couId, role);
......
429 433
            id, @PathParam("email") String email) {
430 434
        Integer coPersonId = calls.getCoPersonIdByEmail(email);
431 435
        if (coPersonId != null) {
432
            Integer couId = calls.getCouId(type, id);
436
            Integer couId = calls.getCouId(type, id, false);
433 437
            Integer role = null;
434 438
            if(couId != null) {
435 439
                role = calls.getRoleId(coPersonId, couId);
......
461 465
    @PreAuthorize("hasAnyAuthority(@AuthorizationService.PORTAL_ADMIN," +
462 466
            "@AuthorizationService.curator(#type), @AuthorizationService.manager(#type, #id))")
463 467
    public Response getMembers(@PathParam("type") String type, @PathParam("id") String id) {
464
        Integer couId = calls.getCouId(type, id);
468
        Integer couId = calls.getCouId(type, id,false);
465 469
        if(couId != null) {
466 470
            JsonArray members = calls.getUserNamesByCouId(couId, false);
467 471
            return Response.status(HttpStatus.OK.value()).entity(jsonUtils.createResponse(members).toString()).type(MediaType.APPLICATION_JSON).build();
......
479 483
    @PreAuthorize("hasAnyAuthority(@AuthorizationService.PORTAL_ADMIN," +
480 484
            "@AuthorizationService.curator(#type), @AuthorizationService.manager(#type, #id))")
481 485
    public Response getMembersEmail(@PathParam("type") String type, @PathParam("id") String id) {
482
        Integer couId = calls.getCouId(type, id);
486
        Integer couId = calls.getCouId(type, id, false);
483 487
        if(couId != null) {
484 488
            JsonArray members = calls.getUserEmailByCouId(couId, false);
485 489
            return Response.status(HttpStatus.OK.value()).entity(jsonUtils.createResponse(members).toString()).type(MediaType.APPLICATION_JSON).build();
......
495 499
    @GET
496 500
    @Produces(MediaType.APPLICATION_JSON)
497 501
    public Response getMembersCount(@PathParam("type") String type, @PathParam("id") String id) {
498
        Integer couId = calls.getCouId(type, id);
502
        Integer couId = calls.getCouId(type, id, false);
499 503
        int count = 0;
500 504
        if(couId != null) {
501 505
            count = calls.getUserNamesByCouId(couId, false).size();

Also available in: Unified diff