ProductBundleAccessControlHandler.php in Commerce Product Bundle 8
Namespace
Drupal\commerce_product_bundleFile
src/ProductBundleAccessControlHandler.phpView source
<?php
namespace Drupal\commerce_product_bundle;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\entity\EntityAccessControlHandler as BaseEntityAccessControlHandler;
/**
* Controls access based on the Commerce Product Bundle permissions.
*
* @see \Drupal\commerce_product_bundle\EntityPermissionProvider
*/
class ProductBundleAccessControlHandler extends BaseEntityAccessControlHandler {
/**
* {@inheritdoc}
*/
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
if ($operation == 'view' && $entity
->isPublished()) {
return AccessResult::allowed();
}
return parent::checkAccess($entity, $operation, $account);
}
}
Classes
Name | Description |
---|---|
ProductBundleAccessControlHandler | Controls access based on the Commerce Product Bundle permissions. |