You are here

public function SupportTicketRevisionAccessCheck::access in Support Ticketing System 8

Checks routing access for the support_ticket revision.

Parameters

\Symfony\Component\Routing\Route $route: The route to check against.

\Drupal\Core\Session\AccountInterface $account: The currently logged in account.

int $support_ticket_revision: (optional) The support_ticket revision ID. If not specified, but $support_ticket is, access is checked for that object's revision.

\Drupal\support_ticket\SupportTicketInterface $support_ticket: (optional) A support_ticket object. Used for checking access to a support_ticket's default revision when $support_ticket_revision is unspecified. Ignored when $support_ticket_revision is specified. If neither $support_ticket_revision nor $support_ticket are specified, then access is denied.

Return value

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

File

modules/support_ticket/src/Access/SupportTicketRevisionAccessCheck.php, line 78
Contains \Drupal\support_ticket\Access\SupportTicketRevisionAccessCheck.

Class

SupportTicketRevisionAccessCheck
Provides an access checker for support_ticket revisions.

Namespace

Drupal\support_ticket\Access

Code

public function access(Route $route, AccountInterface $account, $support_ticket_revision = NULL, SupportTicketInterface $support_ticket = NULL) {
  if ($support_ticket_revision) {
    $support_ticket = $this->supportTicketStorage
      ->loadRevision($support_ticket_revision);
  }
  $operation = $route
    ->getRequirement('_access_support_ticket_revision');
  return AccessResult::allowedIf($support_ticket && $this
    ->checkAccess($support_ticket, $account, $operation))
    ->cachePerPermissions();
}