You are here

public function InviteAccessController::withdrawInviteAccess in Invite 8

1 string reference to 'InviteAccessController::withdrawInviteAccess'
invite.routing.yml in ./invite.routing.yml
invite.routing.yml

File

src/Controller/InviteAccessController.php, line 37

Class

InviteAccessController
Defines the access control handler for invite routes.

Namespace

Drupal\invite\Controller

Code

public function withdrawInviteAccess(AccountInterface $account) {
  $badge_admin = $account
    ->hasPermission('administer invite settings');
  if ($badge_admin) {
    return AccessResult::allowed();
  }
  else {

    /** @var \Drupal\invite\InviteInterface $invite */
    $invite_from_url = $this->routeMatch
      ->getParameter('invite');
    return AccessResult::allowedIf($account
      ->id() && $account
      ->id() == $invite_from_url
      ->getOwnerId() && $account
      ->hasPermission('resend own invitations'))
      ->cachePerPermissions()
      ->cachePerUser();
  }
}