You are here

public function EntityAccess::resolve in GraphQL 8.4

Resolver.

Parameters

\Drupal\Core\Entity\EntityInterface $entity:

string $operation:

\Drupal\Core\Session\AccountInterface $user:

Return value

bool|\Drupal\Core\Access\AccessResultInterface

File

src/Plugin/GraphQL/DataProducer/Entity/EntityAccess.php, line 45

Class

EntityAccess
Returns whether the given user has access to the entity.

Namespace

Drupal\graphql\Plugin\GraphQL\DataProducer\Entity

Code

public function resolve(EntityInterface $entity, $operation = NULL, AccountInterface $user = NULL) {
  return $entity
    ->access($operation ?? 'view', $user);
}