code: public Collection<Integer> keepAuthorizedUsersForRoleAndProject(DbSession dbSession, Collection<Integer> userIds, String role, long projectId) {
      return executeLargeInputs(
        userIds,
        partitionOfIds -> mapper(dbSession).keepAuthorizedUsersForRoleAndProject(role, projectId, partitionOfIds),
        partitionSize -> partitionSize / 3);
    }
docs: Keep only authorized user that have the given permission on a given project.
  Please Note that if the permission is 'Anyone' is NOT taking into account by this method.