Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RequestMapping(params = "action=get_role_permissions")
- @PreAuthorize("hasRole('ROLE_USER_READER')")
- public
- @ResponseBody
- JsonResponse getUserRolePermissions(@RequestParam("id") Long userRoleId,
- @RequestParam String language)
- throws InvalidBusinessOperationException {
- try {
- //get user role view
- UserRoleView role = userRoleService.getViewById(userRoleId, language);
- boolean isAdmin = UserRoleService.userAdminID.equals(userRoleId);
- //get role permission rules
- Map<Long, UserPermissionRuleView> rules = role.getRules();
- //build form json from view
- List<UserPermissionRuleJson> data = settingsAssembler.buildUserPermissionRuleJson(rules.values(), !isAdmin);
- return new SuccessResponse(data);
- } catch (EntityNotFoundException e) {
- throw new InvalidBusinessOperationException(getErrorMessage("error.business.notfound.role"), e);
- }
- }
Add Comment
Please, Sign In to add comment