Sunday, June 26, 2011

Debugging Drupal Access Denied

I just finished debugging an Access Denied problem in Drupal, and wanted to add a couple more tips to those in Simon Lane's Drupal Permissions Issues: A Debugging Checklist

First: assure that the users unable to access the content have been given the appropriate roles.

Second: check the permissions of a role that can access the content relative to one that can't -- the following query works in MySQL and is both quicker, and more accurate, than a visual check.

select permission, module from role_permission 
where rid = 5
and permission not in
(select permission from role_permission where rid = 4)

Where "5" is id of the role that has access, "4" is the id of the role being denied access.

Third, and most obvious: assure that the "inaccessible" content has been published. This was the source of my particular problem (doh!).


I echo the words of many posters, when I say "It would be nice if Drupal would log the reason for denying access. It would save everyone a lot of time"