Menu Item Role Access

Hi,

I wanted to restrict one menu item in my main navigation to a specific role. I downloaded the Menu Item Role Access, ticked the right box in the menu configuration (Menu Item Roles) for the correct role but it doesn’t work (which means, that any other role can see it also).
Has anyone experience with this Module and had the same problem?

For now I made a Plan B and unpublished the menu item and set permissions that the role can view unpublished content but it would be nice to get it to work.

Kind regards,
Nadine

Hello Nadine,

I have not used this role before but are you sure that the role that you are testing does not have more roles than you think it has? You can confirm it by visiting the People page (/admin/people) and have a look in the roles column of the account you are using to test.

By the way the default behaviour of Drupal is that it renders only menu elements that the user can see. What is your use case that you need this module?

Konstantinos

Hello Konstantinos,

Yes, I am sure. I enabled it for one of my service accounts, so for the role “CERN Shared”. And the menu item does not display when signed in as the service account.
(The e-group assignment from this post didn’t work, the service account has still just the “CERN Shared” role. The assignment to the e-group is now about a day ago, could it be possible that updating permissions take longer that a day? I thought it only were a couple of hours. I have created a ticket because of that issue.)

How can I tell Drupal which menu element a user can see? I know about the configure block option (I’m using this for other menus). Is there also an option to configure one menu item, say one specific node, a landing page? Because it would be only one menu item in the main navigation.

I want to have a “How to Website”- Section for the Content Creators of the website. So content on how to built some specific articles, something useful for them to have when they didn’t create any content before on the website (specifically for our website). This should be hidden for all other users, so just be shown for the content creators and administrators.

I choose the menu item role access module, because it looked simple to me. But it doesn’t work directly.

Nadine

That means that the user is not assigned to the role and as a result there is a misconfiguration in the mapping between egroups and roles. Are you sure you have mapped the egroup correctly as mentioned in this article? If not just post here the website and I will have a look.

By default Drupal renders in the menu only the menu items that you have access. For example if there is a node that I dont have access to see, Drupal will not render it in the menu when I visit a page. So all you have to do is create a node that only admins (or whatever role you will choose) have access to read.

To be honest for that I wouldnt mess with the module you try to configure. I have a simpler solution I can propose.

  • Create a content type (eg. Admin Guide)
  • Add the fields you want (eg. body)
  • In the permissions page of your site (/admin/people/permissions) make the content of this content type to the roles you want (using Node View Permission module). This module gives more granular permissions in order to give read access per role and per content type.
  • Add the node to the menu. Only the users who have read access to the content will see it.

Konstantinos

Yes, and it worked before for other users for the role “content creator”.
The website is new-alpha.web.cern.ch

Where can you choose a role for a specific node? I only know the edit and view content permissions for content types.
image

That is probably more convenient, thank you!
For the Node View Permission module: How can you rebuild permissions?

The solution I provided in my answer above (using Node View Permissions) gives access per content type and not per node. If you want permissions per node you can have a look in other modules that enable that kind of permissions. You can find a discussion about it in this thread.

In my opinion giving access per content type is cleaner because you know exactly where you have given permission and where not.

You can do that by visiting /admin/reports/status/rebuild

Konstantinos

Sounds like a good idea, I will try that!

I have kind of the same problem as @cat.hoch in this post.
One of my service accounts has now the content creator role (is in the e-group). But the other service account is still not updated. I opened a ticket and it resumed that maybe it takes more time to take effect than the usual “few hours”.

Nadine

Regarding that, there might be an issue between e-groups and the infrastructure but I don’t have access to see that. Opening a ticket is the best you can do at that point :+1:

Konstantinos