public function listProfiles() {
    $dirs = $this->config['profile.dirs'];
    $profiles = array();
    foreach ($dirs as $dir) {
      if (!is_dir($dir) || !is_readable($dir)) {
        continue;
      }
      $files = scandir($dir);
      foreach ($files as $file) {
        if (preg_match('/(.*)\.profile$/', $file, $m)) {
           $profiles[] = $m[1];
        }
      }
    }
    return $profiles;
  }