Skip to content
Snippets Groups Projects
Commit 66239988 authored by Angie Byron's avatar Angie Byron
Browse files

Revert "Issue #2105123 by pwolanin: Add a currentUser() method to \Drupal\Core\Plugin\PluginBase."

Needs more discussion.

This reverts commit feaee01e.
parent ea72375a
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -22,25 +22,6 @@ abstract class PluginBase extends ComponentPluginBase {
*/
protected $translationManager;
/**
* Current user object.
*
* @var \Drupal\Core\Session\AccountInterface
*/
protected $currentUser;
/**
* Gets the current active user.
*
* @return \Drupal\Core\Session\AccountInterface
*/
protected function currentUser() {
if (!$this->currentUser) {
$this->currentUser = \Drupal::currentUser();
}
return $this->currentUser;
}
/**
* Translates a string to the current language or to a given language.
*
......
......@@ -120,7 +120,7 @@ public function execute() {
->select('users')
->extend('Drupal\Core\Database\Query\PagerSelectExtender');
$query->fields('users', array('uid'));
$user_account = $this->currentUser();
$user_account = $this->request->attributes->get('_account');
if ($user_account->hasPermission('administer users')) {
// Administrators can also search in the otherwise private email field, and
// they don't need to be restricted to only active users.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment