You are here

public function DashboardSectionStorage::access in Dashboards with Layout Builder 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/SectionStorage/DashboardSectionStorage.php \Drupal\dashboards\Plugin\SectionStorage\DashboardSectionStorage::access()

Overrides \Drupal\Core\Access\AccessibleInterface::access().

Overrides SectionStorageInterface::access

1 method overrides DashboardSectionStorage::access()
UserDashboardSectionStorage::access in src/Plugin/SectionStorage/UserDashboardSectionStorage.php
Overrides \Drupal\Core\Access\AccessibleInterface::access().

File

src/Plugin/SectionStorage/DashboardSectionStorage.php, line 260

Class

DashboardSectionStorage
Dashboard section storage.

Namespace

Drupal\dashboards\Plugin\SectionStorage

Code

public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
  if (!$account) {
    $account = $this->account;
  }
  $result = AccessResult::allowedIfHasPermission($account, 'administer dashboards');
  if ($return_as_object) {
    return $result;
  }
  return $result
    ->isAllowed();
}