You are here

public function TaskController::executeTasksAccess in Search API 8

Checks access for executing pending tasks.

Parameters

\Drupal\Core\Session\AccountInterface $account: Run access checks for this account.

Return value

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

1 string reference to 'TaskController::executeTasksAccess'
search_api.routing.yml in ./search_api.routing.yml
search_api.routing.yml

File

src/Controller/TaskController.php, line 76

Class

TaskController
Returns responses for task-related routes.

Namespace

Drupal\search_api\Controller

Code

public function executeTasksAccess(AccountInterface $account) {
  if ($this->taskManager
    ->getTasksCount()) {
    return AccessResult::allowedIfHasPermission($account, 'administer search_api')
      ->addCacheTags([
      'search_api_task_list',
    ]);
  }
  return AccessResult::forbidden()
    ->addCacheTags([
    'search_api_task_list',
  ]);
}