You are here

class PaymentOperationAccessCheck in Commerce Core 8.2

Provides an access checker for payment operations.

Hierarchy

Expanded class hierarchy of PaymentOperationAccessCheck

1 string reference to 'PaymentOperationAccessCheck'
commerce_payment.services.yml in modules/payment/commerce_payment.services.yml
modules/payment/commerce_payment.services.yml
1 service uses PaymentOperationAccessCheck
access_check.commerce_payment.operation in modules/payment/commerce_payment.services.yml
Drupal\commerce_payment\Access\PaymentOperationAccessCheck

File

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

Namespace

Drupal\commerce_payment\Access
View source
class PaymentOperationAccessCheck implements AccessInterface {

  /**
   * Checks access to the payment operation on the given route.
   *
   * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
   *   The route match.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The current user account.
   *
   * @return \Drupal\Core\Access\AccessResultInterface
   *   The access result.
   */
  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);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PaymentOperationAccessCheck::access public function Checks access to the payment operation on the given route.