You are here

public function ScheduledUpdateAddController::addPageAccess in Scheduled Updates 8

Determine access to update add page.

If user has permission to add any types they should have access to this page.

Parameters

\Drupal\Core\Session\AccountInterface $account:

Return value

\Drupal\Core\Access\AccessResult

1 string reference to 'ScheduledUpdateAddController::addPageAccess'
scheduled_updates.routing.yml in ./scheduled_updates.routing.yml
scheduled_updates.routing.yml

File

src/Controller/ScheduledUpdateAddController.php, line 141
Contains Drupal\scheduled_updates\Controller\ScheduledUpdateAddController.

Class

ScheduledUpdateAddController
Class ScheduledUpdateAddController.

Namespace

Drupal\scheduled_updates\Controller

Code

public function addPageAccess(AccountInterface $account) {
  $types = $this->typeStorage
    ->loadMultiple();
  $perms = [];
  foreach ($types as $type_id => $type) {
    $perms[] = "create {$type_id} scheduled updates";
  }
  return AccessResult::allowedIfHasPermissions($account, $perms, 'OR');
}