eZ\Publish\Core\Repository\RoleService::validatePolicy PHP Method

validatePolicy() protected method

Validates Policy context: Limitations on a module and function.
protected validatePolicy ( string $module, string $function, array $limitations ) : ValidationError[][]
$module string
$function string
$limitations array
return eZ\Publish\Core\FieldType\ValidationError[][]
    protected function validatePolicy($module, $function, array $limitations)
    {
        if ($module !== '*' && $function !== '*' && !empty($limitations)) {
            $limitationSet = array();
            foreach ($limitations as $limitation) {
                if (isset($limitationSet[$limitation->getIdentifier()])) {
                    throw new InvalidArgumentException('limitations', "'{$limitation->getIdentifier()}' was found several times among the limitations");
                }
                if (!isset($this->settings['policyMap'][$module][$function][$limitation->getIdentifier()])) {
                    throw new InvalidArgumentException('policy', "The limitation '{$limitation->getIdentifier()}' is not applicable on '{$module}/{$function}'");
                }
                $limitationSet[$limitation->getIdentifier()] = true;
            }
        }
        return $this->limitationService->validateLimitations($limitations);
    }