You are here

public function PhotosImageController::access in Album Photos 8.4

A custom access check.

Parameters

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

1 string reference to 'PhotosImageController::access'
photos.routing.yml in ./photos.routing.yml
photos.routing.yml

File

src/Controller/PhotosImageController.php, line 99

Class

PhotosImageController
Image view controller.

Namespace

Drupal\photos\Controller

Code

public function access(AccountInterface $account) {

  // Check if user can view account photos.
  $fid = $this->routeMatch
    ->getParameter('file');
  if (_photos_access('imageView', $fid)) {

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