public function UserDashboardSectionStorage::access in Dashboards with Layout Builder 8
Same name and namespace in other branches
- 2.0.x src/Plugin/SectionStorage/UserDashboardSectionStorage.php \Drupal\dashboards\Plugin\SectionStorage\UserDashboardSectionStorage::access()
Overrides \Drupal\Core\Access\AccessibleInterface::access().
Overrides DashboardSectionStorage::access
File
- src/
Plugin/ SectionStorage/ UserDashboardSectionStorage.php, line 135
Class
- UserDashboardSectionStorage
- Class DashboardSectionStorage.
Namespace
Drupal\dashboards\Plugin\SectionStorageCode
public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
if (!$account) {
$account = $this->account;
}
$result = AccessResult::allowedIfHasPermission($account, 'administer dashboards')
->orIf(AccessResult::allowedIfHasPermission($account, 'can override ' . $this
->getDashboard()
->id() . ' dashboard'));
if ($return_as_object) {
return $result;
}
return $result
->isAllowed();
}