@Test public void addPermissionsToRole() { BRole r = roleRepository.save(EntityUtil.getSampleRole(random.nextString())); assertNotNull(r); BPermission p1 = permissionRepository.save(EntityUtil.getSamplePermission(random.nextString())); assertNotNull(p1); BPermission p2 = permissionRepository.save(EntityUtil.getSamplePermission(random.nextString())); assertNotNull(p2); Collection<Long> pIDs = new LinkedList<>(); pIDs.add(p1.getId()); pIDs.add(p2.getId()); try { List<Long> added = roleService.addPermissionsToRole(r.getId(), pIDs); assertEquals(added.size(), pIDs.size()); assertTrue(added.contains(p1.getId())); assertTrue(added.contains(p2.getId())); } catch (NotFoundEntityException e) { LOGGER.error(e.getLocalizedMessage()); fail("Could not add permissions to role"); } }
public List<Long> addPermissionsToRole(final long roleId, final Iterable<Long> permissionsId) throws NotFoundEntityException { return addRemovePermissionToFromRole(roleId, permissionsId, ActionOverRolePermissions.ADD_PERMISSIONS); }
RoleService { public List<Long> addPermissionsToRole(final long roleId, final Iterable<Long> permissionsId) throws NotFoundEntityException { return addRemovePermissionToFromRole(roleId, permissionsId, ActionOverRolePermissions.ADD_PERMISSIONS); } }
RoleService { public List<Long> addPermissionsToRole(final long roleId, final Iterable<Long> permissionsId) throws NotFoundEntityException { return addRemovePermissionToFromRole(roleId, permissionsId, ActionOverRolePermissions.ADD_PERMISSIONS); }  }
RoleService { public List<Long> addPermissionsToRole(final long roleId, final Iterable<Long> permissionsId) throws NotFoundEntityException { return addRemovePermissionToFromRole(roleId, permissionsId, ActionOverRolePermissions.ADD_PERMISSIONS); }  BRole createDefaultRole(); List<Long> addPermissionsToRole(final long roleId, final Iterable<Long> permissionsId); List<Long> removePermissionsFromRole(final long roleId, final Iterable<Long> permissionsId); List<Long> updatePermissionsInRole(final long roleId, final Iterable<Long> permissionsId); BRole getRole(final long id); Page<BPermission> getAllPermissionsByRoleId(final long id, final Pageable pageable); }
RoleService { public List<Long> addPermissionsToRole(final long roleId, final Iterable<Long> permissionsId) throws NotFoundEntityException { return addRemovePermissionToFromRole(roleId, permissionsId, ActionOverRolePermissions.ADD_PERMISSIONS); }  BRole createDefaultRole(); List<Long> addPermissionsToRole(final long roleId, final Iterable<Long> permissionsId); List<Long> removePermissionsFromRole(final long roleId, final Iterable<Long> permissionsId); List<Long> updatePermissionsInRole(final long roleId, final Iterable<Long> permissionsId); BRole getRole(final long id); Page<BPermission> getAllPermissionsByRoleId(final long id, final Pageable pageable); static final String ROLE_NOT_FOUND; }