public function getAllowedDatasetList()

in modules/quanthub_core/src/AllowedContentManager.php [91:130]


  public function getAllowedDatasetList() {
    // For admin, editor and publisher, show all content related to datasets.
    // @todo remove publisher and content_editor when entitlements released.
    if (
      $this->currentUser->id() == 1 ||
      in_array('content_editor', $this->currentUser->getRoles()) ||
      in_array('publisher', $this->currentUser->getRoles())
    ) {
      return [];
    }

    // Check that user authenticated and is not admin.
    // Check that dataset list is not already saved to cache.
    if ($cache = $this->cache->get($this->getCacheCid())) {
      if (!empty($cache->data)) {
        $this->datasets = $cache->data;
      }
      else {
        $this->datasets = [];
      }
    }
    else {
      $this->datasets = $this->getUserDatasetList();

      // Update datasets in cache.
      if ($this->datasets) {
        $this->cache->set(
          $this->getCacheCid(),
          $this->datasets,
          $this->time->getCurrentTime() + $this::CACHE_TIME
        );

        // Invalidating cache tags for updating views
        // with datasets and publications.
        Cache::invalidateTags(['allowed_content_tag:' . $this->currentUser->id()]);
      }
    }

    return $this->datasets;
  }