AutobanAccessController.php in Automatic IP ban (Autoban) 8
Namespace
Drupal\autobanFile
src/AutobanAccessController.phpView source
<?php
namespace Drupal\autoban;
use Drupal\Core\Entity\EntityAccessControlHandler;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;
/**
* Defines an access controller for the autoban entity.
*
* We set this class to be the access controller in Autoban's entity annotation.
*
* @see \Drupal\autoban\Entity\Autoban
*
* @ingroup autoban
*/
class AutobanAccessController extends EntityAccessControlHandler {
/**
* {@inheritdoc}
*/
public function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
// The $opereration parameter tells you what sort of operation access is
// being checked for.
if ($operation == 'view') {
return TRUE;
}
// Other than the view operation, we're going to be insanely lax about
// access. Don't try this at home!
return parent::checkAccess($entity, $operation, $account);
}
}
Classes
Name![]() |
Description |
---|---|
AutobanAccessController | Defines an access controller for the autoban entity. |