You are here

public function UserEnrollInviteController::access in Open Social 10.3.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_event/modules/social_event_invite/src/Controller/UserEnrollInviteController.php \Drupal\social_event_invite\Controller\UserEnrollInviteController::access()
  2. 10.0.x modules/social_features/social_event/modules/social_event_invite/src/Controller/UserEnrollInviteController.php \Drupal\social_event_invite\Controller\UserEnrollInviteController::access()
  3. 10.1.x modules/social_features/social_event/modules/social_event_invite/src/Controller/UserEnrollInviteController.php \Drupal\social_event_invite\Controller\UserEnrollInviteController::access()
  4. 10.2.x modules/social_features/social_event/modules/social_event_invite/src/Controller/UserEnrollInviteController.php \Drupal\social_event_invite\Controller\UserEnrollInviteController::access()

Checks access for a specific request.

Parameters

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

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

Overrides CancelEnrollInviteController::access

1 string reference to 'UserEnrollInviteController::access'
social_event_invite.routing.yml in modules/social_features/social_event/modules/social_event_invite/social_event_invite.routing.yml
modules/social_features/social_event/modules/social_event_invite/social_event_invite.routing.yml

File

modules/social_features/social_event/modules/social_event_invite/src/Controller/UserEnrollInviteController.php, line 106

Class

UserEnrollInviteController
Accepts or declines an event enrollment invite.

Namespace

Drupal\social_event_invite\Controller

Code

public function access(AccountInterface $account) {

  // Get the parameter from the request that has been done.
  $user_parameter = $this->requestStack
    ->getCurrentRequest()->attributes
    ->get('user');

  // Check if it's the same that is in the current session's account.
  if ($account
    ->id() === $user_parameter) {
    return AccessResult::allowed();
  }
  return AccessResult::neutral();
}