AccessManager::performCheck

protected AccessManager::performCheck($service_id, ArgumentsResolverInterface $arguments_resolver)

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.

File

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

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;
}
doc_Drupal
2016-10-29 08:42:26
Comments
Leave a Comment

Please login to continue.