code: protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
  
      switch ($operation) {
        case 'view':
          // Check for status and set 'published' or 'unpublished'.
          $status = ($entity->status->value) ? 'published' : 'unpublished';
          return AccessResult::allowedIf($account->hasPermission('access content') && $account->hasPermission('view ' . $status . ' terms in ' . $entity->bundle()));
  
        default:
          return parent::checkAccess($entity, $operation, $account);
  
      }
    }
docs: {@inheritdoc}