我是否需要在操作类中使用 preExecute() 函数来检查 Symfony 中的正确凭据?
要实现凭据,我是否需要实现这样的预执行函数:
public function preExecute() {
$this->configuration = new jobGeneratorConfiguration();
if (!$this->getUser()->hasCredential(
$this->configuration->getCredentials($this->getActionName())
));
}
或者在 module/config/security.yml 中定义它就足够了,如下所示:
all:
is_secure: true
credentials: [ admin ]
但是,我无法仅使用 security.yml 来解决它!我认为 preExecute 是不必要的,symfony 通过加载 security.yml 定义自动处理它! 请帮忙!
我正在使用 sfDoctrineGuardPlugin 和 sfForkedDoctrineApply 插件..
to implement credentials do I need to implement a preExecute function like this:
public function preExecute() {
$this->configuration = new jobGeneratorConfiguration();
if (!$this->getUser()->hasCredential(
$this->configuration->getCredentials($this->getActionName())
));
}
Or is it suffice to have it defined in the module/config/security.yml like this:
all:
is_secure: true
credentials: [ admin ]
However I am not able to work it out using security.yml only! I thought preExecute is not necessary and symfony automatically handles it by loading the security.yml definition!
Please help!
I am using sfDoctrineGuardPlugin and sfForkedDoctrineApply plugin..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无需为此进行预执行。
security.yml 文件足以阻止没有适当凭据的人访问指定的模块或操作。
There is no need for you to do a pre-execute for this.
The security.yml file is enough to stop people without the appropriate credentials from getting to the specified module or action.