public function SocialUserController::accessUsersPages in Open Social 10.3.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_user/src/Controller/SocialUserController.php \Drupal\social_user\Controller\SocialUserController::accessUsersPages()
- 8.8 modules/social_features/social_user/src/Controller/SocialUserController.php \Drupal\social_user\Controller\SocialUserController::accessUsersPages()
- 10.0.x modules/social_features/social_user/src/Controller/SocialUserController.php \Drupal\social_user\Controller\SocialUserController::accessUsersPages()
- 10.1.x modules/social_features/social_user/src/Controller/SocialUserController.php \Drupal\social_user\Controller\SocialUserController::accessUsersPages()
- 10.2.x modules/social_features/social_user/src/Controller/SocialUserController.php \Drupal\social_user\Controller\SocialUserController::accessUsersPages()
Checks access for user page.
Parameters
\Drupal\Core\Session\AccountInterface $account: The current user.
\Drupal\Core\Routing\RouteMatch $routeMatch: The matched route.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
1 string reference to 'SocialUserController::accessUsersPages'
- social_user.routing.yml in modules/
social_features/ social_user/ social_user.routing.yml - modules/social_features/social_user/social_user.routing.yml
File
- modules/
social_features/ social_user/ src/ Controller/ SocialUserController.php, line 95
Class
- SocialUserController
- Class SocialUserController.
Namespace
Drupal\social_user\ControllerCode
public function accessUsersPages(AccountInterface $account, RouteMatch $routeMatch) {
/** @var \Drupal\user\UserInterface $user */
$user = $routeMatch
->getParameter('user');
if (isset($user)) {
if (!$user instanceof UserInterface) {
$user = $this->entityTypeManager
->getStorage('user')
->load($user);
}
}
else {
return AccessResult::neutral();
}
if ($user
->isBlocked()) {
if ($account
->hasPermission('view blocked user')) {
return AccessResult::allowed();
}
return AccessResult::forbidden();
}
return AccessResult::allowed();
}