You are here

public function FeedAddAccessCheck::access in Feeds 8.3

File

src/Access/FeedAddAccessCheck.php, line 35

Class

FeedAddAccessCheck
Access check for feeds link add list routes.

Namespace

Drupal\feeds\Access

Code

public function access(AccountInterface $account) {

  // @todo Perhaps read config directly rather than load all feed types.
  $access_control_handler = $this->entityTypeManager
    ->getAccessControlHandler('feeds_feed');
  foreach ($this->entityTypeManager
    ->getStorage('feeds_feed_type')
    ->loadByProperties([
    'status' => TRUE,
  ]) as $feed_type) {
    $access = $access_control_handler
      ->createAccess($feed_type
      ->id(), $account, [], TRUE);
    if ($access
      ->isAllowed()) {
      return $access;
    }
  }
  return AccessResult::neutral();
}