Esempio n. 1
0
  /**
   * List of user permissions ordered by alphabetical order of user names
   *
   * @param query non-null query including optional filters.
   * @param userLogins if null, then filter on all active users. If not null, then filter on logins,
   *     including disabled users. Must not be empty. If not null then maximum size is {@link
   *     org.sonar.db.DatabaseUtils#PARTITION_SIZE_FOR_ORACLE}.
   */
  public List<UserPermissionDto> select(
      DbSession dbSession,
      String organizationUuid,
      PermissionQuery query,
      @Nullable Collection<String> userLogins) {
    if (userLogins != null) {
      if (userLogins.isEmpty()) {
        return emptyList();
      }
      checkArgument(
          userLogins.size() <= DatabaseUtils.PARTITION_SIZE_FOR_ORACLE,
          "Maximum 1'000 users are accepted");
    }

    RowBounds rowBounds = new RowBounds(query.getPageOffset(), query.getPageSize());
    return mapper(dbSession).selectByQuery(organizationUuid, query, userLogins, rowBounds);
  }