You are here

public function PageManagerPanelsStorage::access in Panels 8.3

Same name and namespace in other branches
  1. 8.4 src/Plugin/PanelsStorage/PageManagerPanelsStorage.php \Drupal\panels\Plugin\PanelsStorage\PageManagerPanelsStorage::access()

Checks if the user has access to a Panels display.

Parameters

string $id: The id for the Panels display within this storage plugin.

string $op: The operation to perform (create, read, update, delete, change layout). If the operation is 'change layout', implementing classes should implicitly check the 'update' permission as well.

\Drupal\Core\Session\AccountInterface $account: The user to check access for.

Return value

\Drupal\Core\Access\AccessResultInterface The access result. If there is no such Panels display then deny access.

Overrides PanelsStorageInterface::access

File

src/Plugin/PanelsStorage/PageManagerPanelsStorage.php, line 112

Class

PageManagerPanelsStorage
A Panels storage service that stores Panels displays in Page Manager.

Namespace

Drupal\panels\Plugin\PanelsStorage

Code

public function access($id, $op, AccountInterface $account) {
  if ($op == 'change layout') {
    $op = 'update';
  }
  if ($page_variant = $this
    ->loadPageVariant($id)) {
    return $page_variant
      ->access($op, $account, TRUE);
  }
  return AccessResult::forbidden();
}