【发布时间】:2017-10-24 08:27:46
【问题描述】:
我在访问控制中使用参数时遇到问题(symfony 3.3.)* :
-
path: ^/api
allow_if: "has_role('ROLE_API_USER') or request.getHost() in '%internal_host%'"
堆栈跟踪错误:
A string value must be composed of strings and/or numbers, but found parameter "internal_host" of type array inside string value "has_role('ROLE_API_USER') or request.getHost() in '%internal_host%'"
我尝试了其他方式,例如 request.getHost() in parameter('internal_host') 或 request.getHost() in container.getParameter('internal_host'),但我收到了类似 The function "parameter" does not exist around position 51 for expression has_role('ROLE_API_USER') or request.getHost() in parameter('internal_host'). 的错误消息(容器服务的消息相同)。
如何在表达式语言的访问控制中使用参数?
【问题讨论】:
-
不重复这是为了安全访问控制不是为了路由,我已经尝试过但没有成功
-
anny 解决方案兄弟!