public function compile(ExpressionCompiler $compiler, FunctionExpression $function)
 {
     $compiler->compileInternal(new VariableExpression('permission_evaluator'))->write('->hasPermission(')->compileInternal(new VariableExpression('token'))->write(', ')->compileInternal($function->args[0])->write(', ');
     if ($function->args[1] instanceof ConstantExpression) {
         $compiler->write(var_export(strtoupper($function->args[1]->value), true) . ')');
         return;
     }
     $compiler->write('strtoupper(')->compileInternal($function->args[1])->write('))');
 }
 public function compile(ExpressionCompiler $compiler, FunctionExpression $function)
 {
     $compiler->compileInternal(new VariableExpression('permission_evaluator'))->write('->hasPermission(')->compileInternal(new VariableExpression('token'))->write(", new Symfony\\Component\\Security\\Acl\\Domain\\ObjectIdentity(")->compileInternal($function->args[0])->write(", -1), ");
     if ($function->args[1] instanceof ConstantExpression) {
         $compiler->write(var_export(strtoupper($function->args[1]->value), true) . ')');
         return;
     }
     $compiler->write('strtoupper(')->compileInternal($function->args[1])->write('))');
 }
 public function compile(ExpressionCompiler $compiler, FunctionExpression $function)
 {
     $compiler->write("(");
     $first = true;
     foreach ($function->args as $arg) {
         if (!$first) {
             $compiler->write(" || ");
         }
         $first = false;
         $compiler->write("isset({$this->rolesExpr}[")->compileInternal($arg)->write("])");
     }
     $compiler->write(")");
 }
 public function compile(ExpressionCompiler $compiler, FunctionExpression $function)
 {
     $compiler->compileInternal(new VariableExpression('container'))->write('->get(' . var_export($this->serviceId, true) . ')')->write('->' . $this->methodName . '(');
     $first = true;
     foreach ($function->args as $arg) {
         if (!$first) {
             $compiler->write(', ');
         }
         $first = false;
         $compiler->compileInternal($arg);
     }
     $compiler->write(')');
 }
 public function compile(ExpressionCompiler $compiler, ExpressionInterface $expr)
 {
     if (isset($this->serviceMap[$expr->name])) {
         $compiler->write("\$context['container']->get('{$this->serviceMap[$expr->name]}'");
         if ($expr->allowNull) {
             $compiler->write(", " . ContainerInterface::NULL_ON_INVALID_REFERENCE);
         }
         $compiler->write(")");
         return;
     }
     if (isset($this->parameterMap[$expr->name])) {
         $compiler->write("\$context['container']->getParameter('{$this->parameterMap[$expr->name]}')");
         return;
     }
     parent::compile($compiler, $expr);
 }
 public function compile(ExpressionCompiler $compiler, ExpressionInterface $expr)
 {
     if ('permitAll' === $expr->name) {
         $compiler->write('true');
         return;
     }
     if ('denyAll' === $expr->name) {
         $compiler->write('false');
         return;
     }
     if ($expr->allowNull) {
         $compiler->write("(isset(\$context['{$expr->name}']) ? ");
     }
     $compiler->write("\$context['{$expr->name}']");
     if ($expr->allowNull) {
         $compiler->write(" : null)");
     }
 }
 public function compile(ExpressionCompiler $compiler, FunctionExpression $function)
 {
     $argName = $compiler->attributes['arg_name'];
     $compiler->write("\${$argName} !== null");
 }
 public function compile(ExpressionCompiler $compiler, ExpressionInterface $expr)
 {
     $compiler->write('!(')->compileInternal($expr->expr)->write(')');
 }
 public function compile(ExpressionCompiler $compiler, FunctionExpression $function)
 {
     $compiler->write("!")->compileInternal(new VariableExpression('trust_resolver'))->write("->isAnonymous(\$context['token'])");
 }
Esempio n. 10
0
 public function compile(ExpressionCompiler $compiler, ExpressionInterface $expr)
 {
     $compiler->write("(")->compileInternal($expr->left)->write(") " . $this->getOperator() . " (")->compileInternal($expr->right)->write(")");
 }
 public function compile(ExpressionCompiler $compiler, FunctionExpression $function)
 {
     $compiler->write("isset({$this->rolesExpr}[")->compileInternal($function->args[0])->write("])");
 }