* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Workflow\EventListener; use Symfony\Component\Security\Core\Authorization\ExpressionLanguage as BaseExpressionLanguage; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Workflow\Exception\RuntimeException; /** * Adds some function to the default Symfony Security ExpressionLanguage. * * @author Fabien Potencier */ class ExpressionLanguage extends BaseExpressionLanguage { protected function registerFunctions() { parent::registerFunctions(); $this->register('is_granted', function ($attributes, $object = 'null') { return sprintf('$auth_checker->isGranted(%s, %s)', $attributes, $object); }, function (array $variables, $attributes, $object = null) { return $variables['auth_checker']->isGranted($attributes, $object); }); $this->register('is_valid', function ($object = 'null', $groups = 'null') { return sprintf('0 === count($validator->validate(%s, null, %s))', $object, $groups); }, function (array $variables, $object = null, $groups = null) { if (!$variables['validator'] instanceof ValidatorInterface) { throw new RuntimeException('"is_valid" cannot be used as the Validator component is not installed.'); } $errors = $variables['validator']->validate($object, null, $groups); return 0 === count($errors); }); } } __halt_compiler();----SIGNATURE:----TWBxkqbr7UaILhK8okR+BNzqwiMcoYgBYqXOEzIwMslcGdRqhh+j4D0YdLHKOC0LyDbA+73uTzVjMvKvvJVB+ddDadvazsinRzS6wiD97lWtBmsi1bIXmgXpCIQfr+qYx+WHVCaPhRrpHDNSakViom4wSLs1cURaDOhNrM6u10Ygd0AYPLgeDqKP/XKV8yDCd8gqRaatQdQVKKTeYnNCOGi0q+KQn3EWzn4zN3WR3SX0rHZcG/O4PtCTnDE4Xp2ndwEoZ1Re9WVY4niCfU6SY5wfIG2gcpVmFj4uKqL60KCbXU0qlf06TRpHdBLq2STxB3YSa5fAV+gNRT+DsVEfL+kGtxHOYR8AwrUIYFFfMGOyRQViH0mrVubh423fTB9raeWRWqv02dme7fVslMfE2XQVR/JnHMesYhFVgDZw19ZN6NuXrGyaUBbUpVP6BT0E/0Z7snXx8buc8vjYlvICW8YLdzKKaYGu58+mYAaaqSvYuBDVb2F7+jDej3x29ZxNO4zOSVmE1ducYF6Vkbjsa9LFKooLDmEUdikE36k6IHYVkj9yplQ1b/696aHLpigHFM9UdNT+g+A4vn2a65Me/y3htTQSD/zW3nU4st1NNH8WBSXDZOpbo+4GaKpXi/IhguNpFZzZouoHUeSX3lA5GwfTTFbfpHNxlnFBki5lzzY=----ATTACHMENT:----NzYwNjI2NTA4NzY2MDE5MCA0MTg3MDc2ODM4OTI3MzYxIDE0NjA2Njg5NDQxOTQzNTY=