You are here

protected function AccessManager::performCheck in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Access/AccessManager.php \Drupal\Core\Access\AccessManager::performCheck()

Performs the specified access check.

Parameters

string $service_id: The access check service ID to use.

\Drupal\Component\Utility\ArgumentsResolverInterface $arguments_resolver: The parametrized arguments resolver instance.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

Throws

\Drupal\Core\Access\AccessException Thrown when the access check returns an invalid value.

1 call to AccessManager::performCheck()
AccessManager::check in core/lib/Drupal/Core/Access/AccessManager.php
Checks a route against applicable access check services.

File

core/lib/Drupal/Core/Access/AccessManager.php, line 155

Class

AccessManager
Attaches access check services to routes and runs them on request.

Namespace

Drupal\Core\Access

Code

protected function performCheck($service_id, ArgumentsResolverInterface $arguments_resolver) {
  $callable = $this->checkProvider
    ->loadCheck($service_id);
  $arguments = $arguments_resolver
    ->getArguments($callable);

  /** @var \Drupal\Core\Access\AccessResultInterface $service_access **/
  $service_access = call_user_func_array($callable, $arguments);
  if (!$service_access instanceof AccessResultInterface) {
    throw new AccessException("Access error in {$service_id}. Access services must return an object that implements AccessResultInterface.");
  }
  return $service_access;
}