From fd33428ad51a57db7f7259d7fe56b6c4887781e6 Mon Sep 17 00:00:00 2001 From: Liam Morland <lkmorlan@uwaterloo.ca> Date: Thu, 11 Mar 2021 17:08:48 -0500 Subject: [PATCH] Revert "ISTWCMS-4631: Create UWService::userIsAdmin()" This reverts commit 9b5d77cf6018c0c19b28db7f5e96becabdf99ba3. --- src/Service/UWService.php | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/Service/UWService.php b/src/Service/UWService.php index 3e0ffbbb..f2589f87 100644 --- a/src/Service/UWService.php +++ b/src/Service/UWService.php @@ -5,7 +5,6 @@ namespace Drupal\uw_cfg_common\Service; use Drupal\Core\Database\Connection; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Session\AccountInterface; use Drupal\node\NodeInterface; use Drupal\simplify_menu\MenuItems; @@ -418,24 +417,4 @@ class UWService implements UWServiceInterface { } } - /** - * Determine whether the user is in an administrator group. - * - * @param \Drupal\Core\Session\AccountInterface $user - * The user object. - * - * @return bool - * TRUE if the user is in an administrator group, FALSE otherwise. - */ - public static function userIsAdmin(AccountInterface $user): bool { - $user_roles = $user->getRoles(); - - // Based on core/modules/user/src/AccountSettingsForm.php. - $admin_roles = \Drupal::service('entity_type.manager')->getStorage('user_role')->getQuery() - ->condition('is_admin', TRUE) - ->execute(); - - return (bool) array_intersect($user_roles, $admin_roles); - } - } -- GitLab