function AccessManager::performCheck

Same name in other branches
  1. 9 core/lib/Drupal/Core/Access/AccessManager.php \Drupal\Core\Access\AccessManager::performCheck()
  2. 8.9.x core/lib/Drupal/Core/Access/AccessManager.php \Drupal\Core\Access\AccessManager::performCheck()
  3. 10 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 156

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.