You are here

public function PhotosUserImages::access in Album Photos 8.4

Overrides BlockPluginTrait::access

File

src/Plugin/Block/PhotosUserImages.php, line 88

Class

PhotosUserImages
Provides a 'Photos user images' block.

Namespace

Drupal\photos\Plugin\Block

Code

public function access(AccountInterface $account, $return_as_object = FALSE) {

  // Check if user can view photos.
  if ($account
    ->hasPermission('view photo')) {
    $access = AccessResult::allowed();
  }
  else {
    $access = AccessResult::forbidden();
  }
  return $return_as_object ? $access : $access
    ->isAllowed();
}