next_for_drupal_pantheon-1.0.x-dev/src/Entity/PantheonNextAccessControlHandler.php

src/Entity/PantheonNextAccessControlHandler.php
<?php

namespace Drupal\next_for_drupal_pantheon\Entity;

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

/**
 * Access controller for the next_for_drupal_pantheon entity.
 *
 * @ingroup next_for_drupal_pantheon
 */
class PantheonNextAccessControlHandler extends EntityAccessControlHandler {

  /**
   * {@inheritdoc}
   */
  protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
    switch ($operation) {
      case 'view':
      case 'update':
      case 'delete':
        return AccessResult::allowedIfHasPermission($account, 'administer site configuration');
    }

    // Unknown operation, no opinion.
    return AccessResult::neutral();
  }

  /**
   * {@inheritdoc}
   */
  protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
    return AccessResult::allowedIfHasPermission($account, 'administer site configuration');
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc