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
b97f821b
Commit
b97f821b
authored
4 years ago
by
Eric Bremner
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-4025: removing manage link in admin toolbar for strictly authenitcated users only
parent
f486d8e1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
uw_cfg_common.module
+27
-0
27 additions, 0 deletions
uw_cfg_common.module
with
27 additions
and
0 deletions
uw_cfg_common.module
+
27
−
0
View file @
b97f821b
...
...
@@ -135,3 +135,30 @@ function uw_cfg_common_form_webform_settings_submissions_form_alter(array &$form
unset
(
$form
[
'submission_behaviors'
][
'token_update'
]);
unset
(
$form
[
'views_settings'
]);
}
/**
* Implements hook_toolbar_alter().
*
* Remove the Manage link from the toolbar for authenticated users.
*/
function
uw_cfg_common_toolbar_alter
(
&
$items
)
{
// Get the current user.
$current_user
=
\Drupal
::
currentUser
();
// Ensure that the current user is not user1.
if
(
$current_user
->
id
()
!==
1
)
{
// Get the roles of the user.
$roles
=
$current_user
->
getRoles
();
// If there is only 1 role and that first role is authenticated, remove the manage link.
// If there are multiple roles then we know that they will have the Manage link, we are
// only removing the manage link for strictly authenticated users only.
if
(
count
(
$roles
)
==
1
&&
$roles
[
0
]
==
'authenticated'
)
{
// Remove the manage link.
unset
(
$items
[
'administration'
]);
}
}
}
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