SupportsPushedReportsAccessCheck.php in SMS Framework 8
Same filename and directory in other branches
Namespace
Drupal\sms\AccessFile
src/Access/SupportsPushedReportsAccessCheck.phpView source
<?php
namespace Drupal\sms\Access;
use Symfony\Component\HttpFoundation\Request;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Routing\Access\AccessInterface;
/**
* Checks if gateway supports pushed reports.
*/
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();
}
}
Classes
Name | Description |
---|---|
SupportsPushedReportsAccessCheck | Checks if gateway supports pushed reports. |