You are here

public function PaymentOperationAccessCheck::access in Commerce Core 8.2

Checks access to the payment operation on the given route.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The route match.

\Drupal\Core\Session\AccountInterface $account: The current user account.

Return value

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

File

modules/payment/src/Access/PaymentOperationAccessCheck.php, line 26

Class

PaymentOperationAccessCheck
Provides an access checker for payment operations.

Namespace

Drupal\commerce_payment\Access

Code

public function access(RouteMatchInterface $route_match, AccountInterface $account) {
  $entity = $route_match
    ->getParameter('commerce_payment');
  $operation = $route_match
    ->getParameter('operation');
  if (empty($entity) || empty($operation)) {
    return AccessResult::neutral();
  }
  return $entity
    ->access($operation, $account, TRUE);
}