You are here

class SupportsPushedReportsAccessCheck in SMS Framework 8

Same name and namespace in other branches
  1. 2.x src/Access/SupportsPushedReportsAccessCheck.php \Drupal\sms\Access\SupportsPushedReportsAccessCheck
  2. 2.1.x src/Access/SupportsPushedReportsAccessCheck.php \Drupal\sms\Access\SupportsPushedReportsAccessCheck

Checks if gateway supports pushed reports.

Hierarchy

Expanded class hierarchy of SupportsPushedReportsAccessCheck

1 string reference to 'SupportsPushedReportsAccessCheck'
sms.services.yml in ./sms.services.yml
sms.services.yml
1 service uses SupportsPushedReportsAccessCheck
access_check.sms.gateway_supports_pushed_reports in ./sms.services.yml
Drupal\sms\Access\SupportsPushedReportsAccessCheck

File

src/Access/SupportsPushedReportsAccessCheck.php, line 12

Namespace

Drupal\sms\Access
View source
class SupportsPushedReportsAccessCheck implements AccessInterface {

  /**
   * Checks if the gateway supports pushed reports.
   */
  public function access(Request $request) {
    if ($request->attributes
      ->has('sms_gateway')) {

      /** @var \Drupal\sms\Entity\SmsGatewayInterface $sms_gateway */
      $sms_gateway = $request->attributes
        ->get('sms_gateway');
      return AccessResult::allowedIf($sms_gateway
        ->supportsReportsPush())
        ->addCacheContexts([
        'route',
      ])
        ->addCacheContexts($sms_gateway
        ->getCacheContexts());
    }
    return AccessResult::neutral();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SupportsPushedReportsAccessCheck::access public function Checks if the gateway supports pushed reports.