During development I used the Menu Item Visibility module to prevent anonymous users from seeing any site content. I had two roles where logins were required and I used the module to hide certain menu items - it worked well.

I now want to make most of the site available to view for anonymous users and I did this by checking the anonymous user check box provided by the module. This worked for some items but not for others. Anonymous users have permission to View content and in the absence of any menu item module overide, surely they should be able to see everything ?

I then uninstalled Menu Item Visibility and removed the module - but no change, two menu trees are not visible to anonymous users.

The problem isn't menu visibility - when I enter the url of a content node anonymous users should be able to see I get an access denied message. So the menu is probably acting correctly, not showing if none of the content below can be seen by the user.

Any suggestions on what to do next ? For example are there any other places where an anonymous user might be stopped from seeing a basic page - other than by the user permissions page ( there are no custom modules setting permissions on the affected pages )? Should I try a fresh install of Menu Item Visibility ? Or should I look at the database and see if I can spot what table entries ( for example legacy entries from Menu Item Visibility ) might be causing this ? Help, please ! Thanks.

Comments

nicoz’s picture

Anytime you I add a contrib module that modifies access control permissions, I always rebuild permissions after enabling and disabling them. Go to /admin/reports/status/rebuild

98% this works.

peterk900’s picture

Yes I remember that's what happened when I installed the module. But it hasn't solved the problem.

I have looked at the node_access table and I find that every item that gives an Access denied message has an entry in the realm column of content_access_rid. Those nodes that display as they should have the value all.

Also the gid column has a value of 2 in access denied pages, and a value of 0 for those pages which are displayed.

I amended one access denied nid record to the values of realm and gid where pages show and the page displays as it should.

Do you see any problems in changing all the other records in the same way ?

peterk900’s picture

I backed up the db and updated the 24 nodes and all seems ok - all the Access Denied messages have gone.. The site is not yet live so if something dreadful happens I can always restore. It looks to me as though something went wrong with the uninstall - maybe my fault, perhaps I should have rebuilt the permissions as Nicoz advised before uninstalling.

Is Menu item Visibilty a good choice - it seems to have a large number of users ? Any other recommendations for setting node/menu item permissions ?

nicoz’s picture

If it's node access you are looking for, I use https://www.drupal.org/project/content_access

Then if the menu item is created on the node itself, the menu item access is automatically handled and will disappear when a person doesn't have access to the node.

peterk900’s picture

That looks just what I want. Thanks. Thank you also for coming back so quickly on this issue. All seems ok so it looks like the db updates have sorted this.