You are here

public static function EntityAccessHelper::getEntityAccessResult in Open Social 8.5

Same name and namespace in other branches
  1. 8.9 modules/custom/entity_access_by_field/src/EntityAccessHelper.php \Drupal\entity_access_by_field\EntityAccessHelper::getEntityAccessResult()
  2. 8 modules/custom/entity_access_by_field/src/EntityAccessHelper.php \Drupal\entity_access_by_field\EntityAccessHelper::getEntityAccessResult()
  3. 8.2 modules/custom/entity_access_by_field/src/EntityAccessHelper.php \Drupal\entity_access_by_field\EntityAccessHelper::getEntityAccessResult()
  4. 8.3 modules/custom/entity_access_by_field/src/EntityAccessHelper.php \Drupal\entity_access_by_field\EntityAccessHelper::getEntityAccessResult()
  5. 8.4 modules/custom/entity_access_by_field/src/EntityAccessHelper.php \Drupal\entity_access_by_field\EntityAccessHelper::getEntityAccessResult()
  6. 8.6 modules/custom/entity_access_by_field/src/EntityAccessHelper.php \Drupal\entity_access_by_field\EntityAccessHelper::getEntityAccessResult()
  7. 8.7 modules/custom/entity_access_by_field/src/EntityAccessHelper.php \Drupal\entity_access_by_field\EntityAccessHelper::getEntityAccessResult()
  8. 8.8 modules/custom/entity_access_by_field/src/EntityAccessHelper.php \Drupal\entity_access_by_field\EntityAccessHelper::getEntityAccessResult()
  9. 10.3.x modules/custom/entity_access_by_field/src/EntityAccessHelper.php \Drupal\entity_access_by_field\EntityAccessHelper::getEntityAccessResult()
  10. 10.0.x modules/custom/entity_access_by_field/src/EntityAccessHelper.php \Drupal\entity_access_by_field\EntityAccessHelper::getEntityAccessResult()
  11. 10.1.x modules/custom/entity_access_by_field/src/EntityAccessHelper.php \Drupal\entity_access_by_field\EntityAccessHelper::getEntityAccessResult()
  12. 10.2.x modules/custom/entity_access_by_field/src/EntityAccessHelper.php \Drupal\entity_access_by_field\EntityAccessHelper::getEntityAccessResult()

Gets the Entity access for the given node.

1 call to EntityAccessHelper::getEntityAccessResult()
entity_access_by_field_node_access in modules/custom/entity_access_by_field/entity_access_by_field.module
Implements hook_node_access().

File

modules/custom/entity_access_by_field/src/EntityAccessHelper.php, line 85

Class

EntityAccessHelper
Helper class for checking entity access.

Namespace

Drupal\entity_access_by_field

Code

public static function getEntityAccessResult(NodeInterface $node, $op, AccountInterface $account) {
  $access = EntityAccessHelper::nodeAccessCheck($node, $op, $account);
  switch ($access) {
    case 2:
      return AccessResult::allowed()
        ->cachePerPermissions()
        ->addCacheableDependency($node);
    case 1:
      return AccessResult::forbidden();
  }
  return AccessResult::neutral();
}