You are here

class PanelsStorageAccess in Panels 8.3

Same name and namespace in other branches
  1. 8.4 src/Storage/PanelsStorageAccess.php \Drupal\panels\Storage\PanelsStorageAccess

Routing access for routes that depend on panels storage.

Hierarchy

Expanded class hierarchy of PanelsStorageAccess

1 string reference to 'PanelsStorageAccess'
panels.services.yml in ./panels.services.yml
panels.services.yml
1 service uses PanelsStorageAccess
panels.storage_access in ./panels.services.yml
Drupal\panels\Storage\PanelsStorageAccess

File

src/Storage/PanelsStorageAccess.php, line 17

Namespace

Drupal\panels\Storage
View source
class PanelsStorageAccess implements RoutingAccessInterface {

  /**
   * The Panels storage manager.
   *
   * @var \Drupal\panels\Storage\PanelsStorageManagerInterface
   */
  protected $panelsStorage;

  /**
   * Constructs a PanelsStorageAccess.
   *
   * @param \Drupal\panels\Storage\PanelsStorageManagerInterface $panels_storage
   *   The Panels storage manager.
   */
  public function __construct(PanelsStorageManagerInterface $panels_storage) {
    $this->panelsStorage = $panels_storage;
  }

  /**
   * Checks if the user has access to underlying storage for a Panels display.
   *
   * @param \Symfony\Component\Routing\Route $route
   *   The route to check against.
   * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
   *   The parametrized route.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The currently logged in account.
   *
   * @return \Drupal\Core\Access\AccessResultInterface
   *   The access result.
   */
  public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account) {
    $panels_storage_type = $route_match
      ->getParameter('panels_storage_type');
    $panels_storage_id = $route_match
      ->getParameter('panels_storage_id');
    $op = $route
      ->getRequirement('_panels_storage_access');
    return $this->panelsStorage
      ->access($panels_storage_type, $panels_storage_id, $op, $account);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PanelsStorageAccess::$panelsStorage protected property The Panels storage manager.
PanelsStorageAccess::access public function Checks if the user has access to underlying storage for a Panels display.
PanelsStorageAccess::__construct public function Constructs a PanelsStorageAccess.