2

I'm testing my website and I have to cope with a strange problem. Although every role has the permission "View published content", only the administrator can access nodes: anonymous users and authenticated users can't. The same problem occurs with adding content. I've tried clearing caches, saving the permissions again and rebuilding the permissions, but nothing helps. I'm not using any modules that control node access either...

How can I solve this?

8
  • Have you tried rebuilding the permissions? Apr 13, 2014 at 19:32
  • @MF82: I did, but it didn't fix the problem either...
    – Jeroen
    Apr 13, 2014 at 21:05
  • You have any additional modules that control node access? Like nodeaccess, entity-access, content access or simple access that might be configured wrong? Apr 13, 2014 at 21:47
  • @Neograph734: No, I'm only using Field Permissions, but I don't think that has anything to do with this...
    – Jeroen
    Apr 13, 2014 at 21:48
  • As long you didn't disable the body field ;) You can try turning it off and see if it helps? Apr 13, 2014 at 21:50

2 Answers 2

11

Things to try when you get inexplicable "Access denied" when non-admins try to view nodes and you're sure every role has the permission "View published content":

  1. Clear all caches. Note that you need to both clear your browser's cache and the Drupal cache on the server. To clear your browser's cache, hold down Shift and reload the page. To clear the server cache, navigate to Administration → Configuration → Development → Performance → Clear all caches. If you use Views, clear Views' cache: Administration → Structure → Views → Settings Advanced → Clear Views' cache. If you've got drush installed (always a good thing to have around), a quick way to clean all caches on the server is drush cc all.

  2. Rebuild permissions: append the path: admin/reports/status/rebuild to your site's base URL, or navigate to Administration → Reports → Status report and look for the link "Rebuild permissions".

  3. Repair the Sessions table: Use phpMyAdmin or a similar tool, choose your Drupal database, check the box next to the {sessions} table, and find the "With selected" drop-down near the bottom of the page. Choose "Repair table".

     enter image description here

  4. If you've just installed a new module, make sure that you've executed a database update. To execute a database update, append the path update.php to you site's base URL. (There will be a link to this page on the Status reports page if Drupal thinks you need to do it.)

  5. Use the DNA module (part of Devel) to debug node access problems. DNA will display a block telling you exactly what permissions are enforced and where they come from. Remember to give give the anonymous and authenticated user roles permission to "Access developer information" to use DNA to debug access problems for these roles. Report your findings here by editing your question if you don't understand the output of DNA.

  6. If none of the above works, start disabling modules to see if one of those causes the problem. Remember to clear caches after disabling a module. You may also want to rebuild permissions (see pt. 2 above) after disabling a module, even if the module don't tell you to do it.

0
0

Something very very silly may bring you at this 'access denied'.

There's a web server serving both http and https (without a proper redirect from "http" > "https"). In this scenario, it may happen that you login at "http" and the access content at "https". From the Drupal point of view, two different sessions. You will get thus "Access denied" if the content you want to read is not for anonymous guests. Again, it is very very silly, but it happens.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.