@PreAuthorize("hasAnyRole('CTRL_PERM_ADD_POST','CTRL_PERM_EDIT_POST')") public Permission getPermission(PermissionDTO permissionDTO) throws RoleNotFoundException { Set<Role> roleList = new HashSet<Role>(); Permission perm = new Permission(); Role role = new Role(); perm.setId(permissionDTO.getId()); perm.setPermissionname(permissionDTO.getPermissionname()); if (permissionDTO.getPermRoles() != null) { for (Integer roleId : permissionDTO.getPermRoles()) { role = roleService.getRole(roleId); logger.debug(" ROLE: " + role.toString()); roleList.add(role); } perm.setPermRoles(roleList); } logger.debug(" PERM: " + perm.toString()); return perm; }
@ModelAttribute("allRoles") @PreAuthorize("hasAnyRole('CTRL_PERM_LIST_GET','CTRL_PERM_EDIT_GET')") public List<Role> getAllRoles() { return roleService.getRoles(); }