You are here

function taxonomy_permissions_entity_insert in Taxonomy Permissions 8

Implements hook_entity_insert().

File

./taxonomy_permissions.module, line 76
taxonomy_permissions.module

Code

function taxonomy_permissions_entity_insert(EntityInterface $entity) {
  if ($entity
    ->getEntityTypeId() == 'taxonomy_vocabulary') {
    $perms[] = 'view terms in ' . $entity
      ->id();
    user_role_grant_permissions(AccountInterface::ANONYMOUS_ROLE, $perms);
    user_role_grant_permissions(AccountInterface::AUTHENTICATED_ROLE, $perms);
  }
}