Taxonomy Permissions & Access
When to Use
Use this guide when configuring granular permissions for taxonomy term operations.
Drupal provides per-vocabulary permissions for term CRUD operations.
Steps
- Understand base permissions — Taxonomy module provides global permissions:
administer taxonomy— Full control over all vocabularies and terms-
access taxonomy overview— View taxonomy overview pages -
Use per-vocabulary permissions — Dynamically generated for each vocabulary:
create terms in VOCAB_ID— Create new terms in vocabularyedit terms in VOCAB_ID— Edit existing termsdelete terms in VOCAB_ID— Delete termsview term revisions in VOCAB_ID— View term revision historyrevert term revisions in VOCAB_ID— Revert to previous revision (requires edit permission too)-
delete term revisions in VOCAB_ID— Delete specific revisions (requires delete permission too) -
Configure via UI — Navigate to
/admin/people/permissions, search for vocabulary name -
Configure via code — Check permissions in access control:
$account = \Drupal::currentUser(); $vid = 'tags'; if ($account->hasPermission('administer taxonomy')) { // Full access } elseif ($account->hasPermission("create terms in $vid")) { // Can create in specific vocabulary }
Pattern
Permission check in controller:
use Drupal\Core\Access\AccessResult;
public function checkAccess($vid) {
$account = \Drupal::currentUser();
return AccessResult::allowedIfHasPermissions(
$account,
["create terms in $vid", 'administer taxonomy'],
'OR'
);
}
Term access check (automatic):
$term = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->load($tid);
// Access checked automatically
if ($term->access('view')) {
// User can view term
}
if ($term->access('update')) {
// User can edit term
}
Reference: /core/modules/taxonomy/src/TermAccessControlHandler.php (lines 20-72)
Decision Points
| At this step... | If... | Then... |
|---|---|---|
| Permission granularity | Users need vocabulary-specific control | Use per-vocabulary permissions |
| Permission granularity | Site admins manage all taxonomy | Grant administer taxonomy |
| View access | Terms should be public | Ensure users have access content permission |
| View access | Terms are unpublished | Only users with administer taxonomy see unpublished terms |
Common Mistakes
- Granting
administer taxonomyto content editors → Too permissive; allows vocabulary deletion and structure changes. Use per-vocabulary permissions instead - Forgetting
access contentfor term viewing → Terms require both published status AND user hasaccess content. Unpublished terms only visible to admins - Not combining edit + revert for revision access → Reverting revisions requires BOTH
revert term revisions in VOCABANDedit terms in VOCAB. Grant both or users see "access denied" - Assuming terms have view permissions like nodes → Terms use simpler access: published +
access contentfor all users, ORadminister taxonomyfor admins. No per-term permissions without contrib - Overlooking vocabulary access in entity reference → If user can't view terms, they won't appear in autocomplete or select widgets. Ensure field users have appropriate permissions
See Also
- ← Previous: Taxonomy Views Integration | Next: Term Storage & Querying →
- Reference:
/core/modules/taxonomy/src/TaxonomyPermissions.php(lines 64-82) - Reference: Drupal.org Permissions by Term module