public function PhotosUserImagesController::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 'PhotosUserImagesController::access'
File
- src/
Controller/ PhotosUserImagesController.php, line 126
Class
- PhotosUserImagesController
- Content controller for user images.
Namespace
Drupal\photos\ControllerCode
public function access(AccountInterface $account) {
// Check if user can view account photos.
$uid = $this->routeMatch
->getParameter('user');
$account = $this->entityTypeManager
->getStorage('user')
->load($uid);
if ($this
->currentUser()
->hasPermission('view photo') && (!$account || _photos_access('viewUser', $account))) {
return AccessResult::allowed();
}
else {
return AccessResult::forbidden();
}
}