diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/filter/Access.php b/core/modules/node/lib/Drupal/node/Plugin/views/filter/Access.php index 57e63fb..34d4668 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/filter/Access.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/filter/Access.php @@ -29,7 +29,7 @@ public function canExpose() { * See _node_access_where_sql() for a non-views query based implementation. */ public function query() { - if (!$this->view->user->hasPermission('administer nodes')) { + if (!$this->view->getUser()->hasPermission('administer nodes')) { $table = $this->ensureMyTable(); $grants = db_or(); foreach (node_access_grants('view') as $realm => $gids) { diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/Language.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/Language.php index 2344942..50270ac 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/views/field/Language.php +++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/Language.php @@ -25,7 +25,7 @@ class Language extends User { protected function renderLink($data, ResultRow $values) { if (!empty($this->options['link_to_user'])) { $uid = $this->getValue($values, 'uid'); - if ($this->view->user->hasPermission('access user profiles') && $uid) { + if ($this->view->getUser()->hasPermission('access user profiles') && $uid) { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = 'user/' . $uid; } diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/User.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/User.php index 2507b98..d10dbad 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/views/field/User.php +++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/User.php @@ -64,7 +64,7 @@ public function buildOptionsForm(&$form, &$form_state) { * Returns a string for the link text. */ protected function renderLink($data, ResultRow $values) { - if (!empty($this->options['link_to_user']) && $this->view->user->hasPermission('access user profiles') && ($entity = $this->getEntity($values)) && $data !== NULL && $data !== '') { + if (!empty($this->options['link_to_user']) && $this->view->getUser()->hasPermission('access user profiles') && ($entity = $this->getEntity($values)) && $data !== NULL && $data !== '') { $this->options['alter']['make_link'] = TRUE; $uri = $entity->uri(); $this->options['alter']['path'] = $uri['path']; diff --git a/core/modules/views/lib/Drupal/views/ViewExecutable.php b/core/modules/views/lib/Drupal/views/ViewExecutable.php index 25262d0..8ad34e6 100644 --- a/core/modules/views/lib/Drupal/views/ViewExecutable.php +++ b/core/modules/views/lib/Drupal/views/ViewExecutable.php @@ -1711,6 +1711,17 @@ public function getPath() { } /** + * Gets the current user. + * + * View plugins can use this to check for certain permissions. + * + * @return \Drupal\Core\Session\AccountInterface + */ + public function getUser() { + return $this->user; + } + + /** * Creates a duplicate ViewExecutable object. * * Makes a copy of this view that has been sanitized of handlers, any runtime