/**
  * {@inheritdoc}
  */
 public function access(EntityInterface $entity, $operation, AccountInterface $account = NULL, $return_as_object = FALSE)
 {
     $account = $this->prepareUser($account);
     if ($account->hasPermission('bypass node access')) {
         $result = AccessResult::allowed()->cachePerPermissions();
         return $return_as_object ? $result : $result->isAllowed();
     }
     if (!$account->hasPermission('access content')) {
         $result = AccessResult::forbidden()->cachePerPermissions();
         return $return_as_object ? $result : $result->isAllowed();
     }
     $result = parent::access($entity, $operation, $account, TRUE)->cachePerPermissions();
     return $return_as_object ? $result : $result->isAllowed();
 }
 /**
  * {@inheritdoc}
  */
 public function access(EntityInterface $entity, $operation, AccountInterface $account = NULL, $return_as_object = FALSE)
 {
     $result = AccessResult::neutral();
     $account = $this->prepareUser($account);
     // $account = workflow_current_user($account);
     /* @var $transition WorkflowTransitionInterface */
     $transition = $entity;
     // This is only for Edit/Delete transition. For Add/create, use createAccess.
     switch ($entity->getEntityTypeId()) {
         case 'workflow_transition':
         case 'workflow_scheduled_transition':
             switch ($operation) {
                 case 'update':
                     $is_owner = WorkflowManager::isOwner($account, $transition);
                     $type_id = $transition->getWorkflowId();
                     if ($account->hasPermission("bypass {$type_id} workflow_transition access")) {
                         $result = AccessResult::allowed()->cachePerPermissions();
                     } elseif ($account->hasPermission("edit any {$type_id} workflow_transition")) {
                         $result = AccessResult::allowed()->cachePerPermissions();
                     } elseif ($is_owner && $account->hasPermission("edit own {$type_id} workflow_transition")) {
                         $result = AccessResult::allowed()->cachePerPermissions();
                     }
                     return $return_as_object ? $result : $result->isAllowed();
                     break;
                 case 'delete':
                     // The delete operation is not defined for Transitions.
                     $result = AccessResult::forbidden();
                     break;
                 case 'revert':
                     // @see workflow_operations.
                 // @see workflow_operations.
                 default:
                     $type_id = $transition->getWorkflowId();
                     $result = parent::access($entity, $account, $return_as_object);
                     //if ($account->hasPermission("bypass $type_id workflow_transition access")) {
                     //  $result = AccessResult::allowed()->cachePerPermissions();
                     //}
                     break;
             }
             // End of switch ($operation).
             break;
         case 'workflow_config_transition':
             workflow_debug(__FILE__, __FUNCTION__, __LINE__, $account->id(), $transition->getOwnerId());
             // @todo D8-port: still test this snippet.
             break;
     }
     $result = parent::access($entity, $operation, $account, TRUE)->cachePerPermissions();
     return $return_as_object ? $result : $result->isAllowed();
 }
 /**
  * {@inheritdoc}
  */
 public function access(EntityInterface $entity, $operation, $langcode = LanguageInterface::LANGCODE_DEFAULT, AccountInterface $account = NULL, $return_as_object = FALSE) {
   /* @var $entity \Drupal\mailchimp_campaign\Entity\MailchimpCampaign */
   $status = $entity->mc_data['status'];
   switch ($operation) {
     case 'send':
     case 'edit':
     case 'delete':
       return ($status == MAILCHIMP_STATUS_SENT) ? AccessResult::forbidden() : AccessResult::allowed();
       break;
     case 'stats':
       return ($status == MAILCHIMP_STATUS_SENT) ? AccessResult::allowed() : AccessResult::forbidden();
     default:
       return parent::access($entity, $operation, $langcode, $account, $return_as_object);
   }
 }
 /**
  * {@inheritdoc}
  */
 public function access(EntityInterface $entity, $operation, AccountInterface $account = NULL, $return_as_object = FALSE)
 {
     $account = $this->prepareUser($account);
     // Checks for bypass permission.
     if ($account->hasPermission('bypass eck entity access')) {
         $result = AccessResult::allowed()->cachePerPermissions();
         return $return_as_object ? $result : $result->isAllowed();
     }
     // Check if the user has permission to access eck entities.
     if (!$account->hasPermission('access eck entities')) {
         $result = AccessResult::forbidden()->cachePerPermissions();
         return $return_as_object ? $result : $result->isAllowed();
     }
     $result = parent::access($entity, $operation, $account, TRUE)->cachePerPermissions();
     return $return_as_object ? $result : $result->isAllowed();
 }
 public function access(EntityInterface $entity, $operation, $langcode = LanguageInterface::LANGCODE_DEFAULT, AccountInterface $account = NULL, $return_as_object = FALSE) {
   return parent::access($entity, $operation, $langcode, $account, $return_as_object); // TODO: Change the autogenerated stub
 }
 public function access(EntityInterface $entity, $operation, AccountInterface $account = NULL, $return_as_object = FALSE)
 {
     return parent::access($entity, $operation, $account, $return_as_object);
     // TODO: Change the autogenerated stub
 }