Avoid unnecessary database hit when logged out
stephandale - June 30, 2009 - 13:27
| Project: | Taxonomy Delegate |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
In response to a previous bug report, you added an access callback to the menu hook. http://drupal.org/node/291665
Function _taxonomy_delegate_access checks access via _taxonomy_delegate_my_vocabularies. You could save on a database hit if the user doesn't have any roles, i.e. is logged out - return an empty array from _taxonomy_delegate_my_vocabularies.
...
foreach ($user->roles as $rid => $name) {
$list[] = $rid;
}
if (0 == count($list)) {
return array();
}
...P.S. Many thanks for the module - I've found it essential to devolve access control when a large site is organised via TAC.
