I gave the permission "use admin toolbar" to a role theat doesn't have the permission to access every configuration page, e.g. not for the user account configuration.
A user of this role has access to the main menu items of the management menu, that are according to his permissions. That's cool, but he can see all the submenu items, even those for which he has no access. When he follows the menu link he gets:
"No Administration objects available."
It would be better if he only could see the submenu items for which he has access to configure.
Comments
Comment #2
reekris commentedI'm experiencing this issue as well. I have a role set up that has the permission "Use the administration pages and help". This is so that the user can see the structure menu item wth the taxonomy menu item as a child. But when I add this persmission, the "Configuration" menu item also becomes visible along with all child items. When visiting any of these pages however, all of them return "You do not have any administrative items."
Expected behavior would be that items returning this error would be hidden, and since all child elements of Configuration would be hidden, also Configuration should be hidden.
I'm unsure if this is an issue with Admin Toolbar or if its actually a core issue. I found a discussion in a similar issue for the Navbar module: #2434655: Menu items not hidden when user has no permission. In comment #3 it is shown that the "structure" and "configuration" menu items are shown based on the "Use the administration pages and help" permission, no matter if the user has permissions to view pages underneath those items or not. I have not found any core issue for this however. Maybe one should be created, since the behavior seems broken?
Edit:
Found this core issue which is still active since 2008(!): #296693: Restrict access to empty top level administration pages
Comment #3
romainj commentedAs I understand it we cannot do anything in the Admin Toolbar module. It is more related to Drupal core. So issue is closed.
Comment #4
a.milkovskyMy current workaround - create a separate menu for the role 'editor'. Menu is called 'editor-menu' in my case. I override admin_toolbar to use editor menu as source in the toolbar.
Comment #5
kkri commentedFor anyone who is looking for a solution until this gets solved in core, consider using this module:
https://www.drupal.org/project/admin_links_access_filter
Comment #6
Leagnus commenteda.milkovsky, thank you, works with admin_toolbar 8.x-1.21+8-dev.
before 2-nd function there should be
use Drupal\Core\Menu\MenuTreeParameters;
Comment #7
bdlangton commentedFor new people looking at this issue, the admin_links_access_filter module has been added as a submodule of admin_toolbar as of 8.x-1.21. It seems to work for me!
Comment #8
mehul.shah commentedThe #7 worked for me.
Comment #9
ankit agrawal commentedAdding admin_links_access_filter module (sub-module of admin_toolbar) fixed the issue for me. Thanks
Comment #10
casey commented