Package org.jtalks.jcommune.web.dto

Examples of org.jtalks.jcommune.web.dto.PermissionGroupsDto


        JsonResponse jsonResponse = administrationController.getGroupsForBranchPermission(dto);

        assertEquals(jsonResponse.getStatus(), JsonResponseStatus.SUCCESS);
        assertTrue(jsonResponse.getResult() instanceof PermissionGroupsDto);
        PermissionGroupsDto result = (PermissionGroupsDto)jsonResponse.getResult();
        assertEquals(result.getAvailableGroups().size(), 3);
        assertEquals(result.getSelectedGroups().size(), 3);
    }
View Full Code Here


     */
    @RequestMapping(value = "/branch/permissions/json", method = RequestMethod.POST)
    @ResponseBody
    public JsonResponse getGroupsForBranchPermission(@RequestBody BranchPermissionDto permissionInfo) {
        long forumId = componentService.getComponentOfForum().getId();
        PermissionGroupsDto permission = new PermissionGroupsDto();

        JtalksPermission branchPermission = permissionManager.findBranchPermissionByMask(permissionInfo.getPermissionMask());
        List<Group> selectedGroups;
        try {
            selectedGroups = branchService.getPermissionGroupsFor(forumId, permissionInfo.getBranchId(),
                    permissionInfo.isAllowed(), branchPermission);
        } catch (NotFoundException e) {
            return new JsonResponse(JsonResponseStatus.FAIL, null);
        }
        List<GroupDto> alreadySelected = GroupDto.convertGroupList(selectedGroups, true);

        List<Group> availableGroups = permissionManager.getAllGroupsWithoutExcluded(selectedGroups, branchPermission);
        List<GroupDto> available = GroupDto.convertGroupList(availableGroups, true);

        permission.setSelectedGroups(alreadySelected);
        permission.setAvailableGroups(available);

        return new JsonResponse(JsonResponseStatus.SUCCESS, permission);
    }
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.web.dto.PermissionGroupsDto

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.