You are here

YamlFormOptionsAccessControlHandler.php in YAML Form 8

Namespace

Drupal\yamlform

File

src/YamlFormOptionsAccessControlHandler.php
View source
<?php

namespace Drupal\yamlform;

use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\EntityAccessControlHandler;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;

/**
 * Defines the access control handler for the form options entity type.
 *
 * @see \Drupal\yamlform\Entity\YamlFormOptions.
 */
class YamlFormOptionsAccessControlHandler extends EntityAccessControlHandler {

  /**
   * {@inheritdoc}
   */
  public function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
    return AccessResult::allowedIf($account
      ->hasPermission('administer yamlform'))
      ->cachePerPermissions();
  }

}

Classes

Namesort descending Description
YamlFormOptionsAccessControlHandler Defines the access control handler for the form options entity type.