Neos\Flow\Security\Policy\Role::getPrivilegeForTarget PHP Method

getPrivilegeForTarget() public method

public getPrivilegeForTarget ( string $privilegeTargetIdentifier, array $privilegeParameters = [] ) : Neos\Flow\Security\Authorization\Privilege\PrivilegeInterface
$privilegeTargetIdentifier string
$privilegeParameters array
return Neos\Flow\Security\Authorization\Privilege\PrivilegeInterface the matching privilege or NULL if no privilege exists for the given constraints
    public function getPrivilegeForTarget($privilegeTargetIdentifier, array $privilegeParameters = [])
    {
        foreach ($this->privileges as $privilege) {
            if ($privilege->getPrivilegeTargetIdentifier() !== $privilegeTargetIdentifier) {
                continue;
            }
            if (array_diff_assoc($privilege->getParameters(), $privilegeParameters) !== []) {
                continue;
            }
            return $privilege;
        }
        return null;
    }