You are here

public function PhotosImageViewController::access in Album Photos 6.0.x

Same name and namespace in other branches
  1. 8.5 src/Controller/PhotosImageViewController.php \Drupal\photos\Controller\PhotosImageViewController::access()

A custom access check.

Parameters

\Drupal\Core\Session\AccountInterface $account: Run access checks for this account.

File

src/Controller/PhotosImageViewController.php, line 99

Class

PhotosImageViewController
Image view controller.

Namespace

Drupal\photos\Controller

Code

public function access(AccountInterface $account) {

  // @todo move to '_entity_access', 'photos_image.view'.
  // Check if user can view account photos.
  $photos_image = $this->routeMatch
    ->getParameter('photos_image');

  // @todo either update access to check entity or get file id...
  if ($photos_image
    ->access('view')) {

    // Allow access.
    return AccessResult::allowed();
  }
  else {
    return AccessResult::forbidden();
  }
}