class FeedAccessControlHandler

Defines an access control handler for the feed entity.

Hierarchy

Expanded class hierarchy of FeedAccessControlHandler

See also

\Drupal\aggregator\Entity\Feed

File

core/modules/aggregator/src/FeedAccessControlHandler.php, line 15

Namespace

Drupal\aggregator
View source
class FeedAccessControlHandler extends EntityAccessControlHandler {
  
  /**
   * {@inheritdoc}
   */
  protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
    switch ($operation) {
      case 'view':
        return AccessResult::allowedIfHasPermission($account, 'access news feeds');
      default:
        return AccessResult::allowedIfHasPermission($account, 'administer news feeds');
    }
  }
  
  /**
   * {@inheritdoc}
   */
  protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
    return AccessResult::allowedIfHasPermission($account, 'administer news feeds');
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.