protected function TranslatorAccessControlHandler::checkAccess

File

src/Entity/Controller/TranslatorAccessControlHandler.php, line 56

Class

TranslatorAccessControlHandler
Access control handler for the translator entity.

Namespace

Drupal\tmgmt\Entity\Controller

Code

protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {

  // Don't allow delete access for busy translators.
  if (!$entity
    ->hasPlugin() && $operation != 'delete' || $operation == 'delete' && tmgmt_translator_busy($entity
    ->id())) {
    return AccessResult::forbidden();
  }
  return AccessResult::allowedIfHasPermission($account, 'administer tmgmt');
}