PermissionChecker.php

Same filename in other branches
  1. 10 core/lib/Drupal/Core/Session/PermissionChecker.php

Namespace

Drupal\Core\Session

File

core/lib/Drupal/Core/Session/PermissionChecker.php

View source
<?php

namespace Drupal\Core\Session;


/**
 * Checks permissions for an account.
 */
class PermissionChecker implements PermissionCheckerInterface {
    public function __construct(AccessPolicyProcessorInterface $processor) {
    }
    
    /**
     * {@inheritdoc}
     */
    public function hasPermission(string $permission, AccountInterface $account) : bool {
        $item = $this->processor
            ->processAccessPolicies($account)
            ->getItem();
        return $item && $item->hasPermission($permission);
    }

}

Classes

Title Deprecated Summary
PermissionChecker Checks permissions for an account.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.