public function PhotosUserAlbumsController::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 'PhotosUserAlbumsController::access'
File
- src/
Controller/ PhotosUserAlbumsController.php, line 87
Class
- PhotosUserAlbumsController
- Display user albums.
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 (!$account || _photos_access('viewUser', $account)) {
return AccessResult::allowed();
}
else {
return AccessResult::forbidden();
}
}