You are here

public function InviteAccessController::resendInviteAccess in Invite 8

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

File

src/Controller/InviteAccessController.php, line 54

Class

InviteAccessController
Defines the access control handler for invite routes.

Namespace

Drupal\invite\Controller

Code

public function resendInviteAccess(AccountInterface $account) {
  $invite_admin = $account
    ->hasPermission('administer invite settings');
  if ($invite_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())
      ->cachePerPermissions()
      ->cachePerUser();
  }
}