2011-10-18 76 views
1

我在Symfony 1.4.13中有一个特定的模块,默认情况下它的security.yml文件被设置为安全。我有一个特定的对象操作,我希望任何人都可以访问(注销的用户),但似乎无法找到正确的方法在YAML文件中取出操作的名称以获得匹配。允许不安全地访问security.yml中的Symfony对象操作

具体来说,我有一个project模块,其中包含典型的索引,显示,创建等操作,以及对象操作(因此操作方法的名称为executeListRunReport)。该security.yml文件如下:

all: 
    is_secure: true 

index: 
    credentials: pm_view 

show: 
    credentials: pm_view 

filter: 
    credentials: pm_view 

runReport: # This is the one that is giving me problems 
    is_secure: false 

我在actions.php方法是:

public function executeListRunReport(sfWebRequest $request) { 
... 
} 

这只是正常的去project/[idOfObject]/ListRunReport当用户登录。

如何编写security.yml文件以允许任何人访问该操作(例如直接从我手动生成的URL中)而无需登录?谢谢!

+0

不确定,但尝试将'all:'更改为'default:' – mblaettermann

回答

1

原来问题出在我在security.yml中命名元素的方式(对不起,如果问题不明确eno呃以表明这可能是原来的问题)。

它与listRunReport,所以代码想这样的:

listRunReport: 
    is_secure:false 

@arsenik是在正确的一切:is_secure:真的是不必要的,但不幸的是这并没有解决问题(它可以保持)。

课程是当使用列表对象操作,最终获得命名为executeListXYZ时,它必须在security.yml中标记为listXYZ。

3

,如果你的应用程序/ * /配置/ security.yml有

default: 
    is_secure: true 

您可以在模块的security.yml定义:

index: 
    credentials: pm_view 

show: 
    credentials: pm_view 

filter: 
    credentials: pm_view 

runReport: 
    is_secure: false 

从你的模块中取出:

all: 
    is_secure: true 
+0

谢谢,这对我的缝合很有帮助。 –