
| Current Path : /var/www/html/rocksensor1/web/core/lib/Drupal/Core/Session/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor1/web/core/lib/Drupal/Core/Session/PermissionChecker.php |
<?php
namespace Drupal\Core\Session;
use Drupal\Core\Entity\EntityTypeManagerInterface;
/**
* Checks permissions for an account.
*/
class PermissionChecker implements PermissionCheckerInterface {
public function __construct(protected EntityTypeManagerInterface|AccessPolicyProcessorInterface $processor) {
if ($this->processor instanceof EntityTypeManagerInterface) {
@trigger_error('Calling ' . __METHOD__ . '() without the $processor argument is deprecated in drupal:10.3.0 and will be required in drupal:11.0.0. See https://www.drupal.org/node/3402107', E_USER_DEPRECATED);
$this->processor = \Drupal::service('access_policy_processor');
}
}
/**
* {@inheritdoc}
*/
public function hasPermission(string $permission, AccountInterface $account): bool {
$item = $this->processor->processAccessPolicies($account)->getItem();
return $item && $item->hasPermission($permission);
}
}