Skip to content
Snippets Groups Projects

Resolve D11 compatibility #3489295

3 files
+ 8
4
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -5,6 +5,7 @@ namespace Drupal\test_users\Commands;
use Consolidation\AnnotatedCommand\CommandData;
use Drupal\Component\Utility\Html;
use Drupal\Core\Entity\EntityStorageException;
use Drupal\user\Entity\Role;
use Drupal\user\Entity\User;
use Drupal\user\RoleInterface;
use Drush\Commands\DrushCommands;
@@ -171,7 +172,8 @@ class TestUsersCommands extends DrushCommands {
// The user module does not offer a way to get all users for a role itself,
// so we use an entity query.
$query = \Drupal::entityQuery('user')
->condition("roles.target_id", $role);
->condition("roles.target_id", $role)
->accessCheck(FALSE);
$result = $query->execute();
@@ -249,7 +251,9 @@ class TestUsersCommands extends DrushCommands {
*
*/
public function getRoles() {
return user_roles(TRUE);
$roles = Role::loadMultiple();
unset($roles[RoleInterface::ANONYMOUS_ID]);
return $roles;
}
}
Loading