1 taxonomy.module | taxonomy_vocabulary_overview_access() |
Access callback: Checks if a user has permission to view the vocabulary overview page. This is anyone who can create/update/delete terms in any existing vocabulary.
Return value
TRUE if the user has access, FALSE otherwise.:
See also
File
- core/
modules/ taxonomy/ taxonomy.module, line 460 - Enables the organization of content into categories.
Code
function taxonomy_vocabulary_overview_access() {
// Users with the 'administer taxonomy' permission always have access.
if (user_access('administer taxonomy')) {
return TRUE;
}
// Check access for each create/update (edit)/delete operation for terms
// in all vocabularies and return TRUE if any of them are allowed.
$vocabularies = taxonomy_vocabulary_load_multiple(FALSE);
$operations = array('create', 'edit', 'delete');
foreach ($vocabularies as $vocabulary) {
foreach ($operations as $operation) {
if (user_access("$operation terms in $vocabulary->machine_name")) {
return TRUE;
}
}
}
// Deny access if the user doesn't have any permissions for any vocabularies.
return FALSE;
}