Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uw_cfg_common
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WCMS
uw_cfg_common
Commits
dc99d818
Commit
dc99d818
authored
4 years ago
by
Liam Morland
Committed by
Kevin Paxman
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Revert "ISTWCMS-4631: Create UWService::userIsAdmin()"
This reverts commit
9b5d77cf
.
parent
fd842fd0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!70
ISTWCMS-4631: Toolbar permissions instead of role checks
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Service/UWService.php
+0
-21
0 additions, 21 deletions
src/Service/UWService.php
with
0 additions
and
21 deletions
src/Service/UWService.php
+
0
−
21
View file @
dc99d818
...
...
@@ -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
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment