2012-06-27 38 views
0

所以我试图通过JMSSecurityExtraBundle为我的一些方法配置安全访问。我只是按照这里的说明:JMSSecurityBundle DocSymfony2:无法识别的选项“method_access_control”在“jms_security_extra”错误

我结束了我的config.yml文件中有这样的:

jms_security_extra: 
    secure_controllers: true 
    secure_all_services: false 
    method_access_control: 
     'MyBundle:.*:postEntityDelete': 'hasRole("ROLE_SUPER_ADMIN")' 

现在我只是收到这个错误:

InvalidConfigurationException: Unrecognized options "method_access_control" under "jms_security_extra" 

我怎么能出现了问题就这么少呢?渔获何处?我如何解决这个问题?

在此先感谢!

编辑:

的DEP:

[JMSSecurityExtraBundle] 
    git=https://github.com/schmittjoh/JMSSecurityExtraBundle.git 
    target=/bundles/JMS/SecurityExtraBundle 

[metadata] 
    git=https://github.com/schmittjoh/metadata.git 
    version=1.1.0 ; <- make sure to get 1.1, not 1.0 

[JMSAopBundle] 
    git=https://github.com/schmittjoh/JMSAopBundle.git 
    target=/bundles/JMS/AopBundle 

[cg-library] 
    git=https://github.com/schmittjoh/cg-library.git 

[JMSDiExtraBundle] 
    git=https://github.com/schmittjoh/JMSDiExtraBundle.git 
    target=/bundles/JMS/DiExtraBundle 

Deps.lock:

symfony v2.0.13 
twig v1.7.0 
monolog 1.0.2 
doctrine-common 2.1.4 
doctrine-dbal 2.1.6 
doctrine 2.1.6 
swiftmailer v4.1.7 
assetic v1.0.3 
twig-extensions 446d870272cd87a720e95242eade38a2acf56eaa 
metadata 1.0.0 
SensioFrameworkExtraBundle cb61b92ed55241d93ed9726bc3f5f47c7d2ce8fe 
JMSSecurityExtraBundle e752f888c51425f71382c056961f10f2be642102 
SensioDistributionBundle 20b66a408084ad8752f98e50f10533f5245310bf 
SensioGeneratorBundle b1ccb78c1743f30817b0fce9bb5c6baff6ed7bf8 
AsseticBundle v1.0.1 

回答

1

您正在使用哪种版本的symfony捆绑的和?您链接的文档在Master分支之后。左上角有链接来更改版本。 1.0似乎没有该配置选项。

的DEPS文件应包含:

[JMSSecurityExtraBundle] 
    git=http://github.com/schmittjoh/JMSSecurityExtraBundle.git 
    target=/bundles/JMS/SecurityExtraBundle 
    version=origin/master 

您还可以在这里看到别人说有同样的问题https://github.com/schmittjoh/JMSSecurityExtraBundle/issues/24

+0

Symfony的2.0和我已经改变了对DEPS主JMSExtraFramework,而不是1.0。 x –

+0

也许还有在deps.lock中引用的更旧的提交?看看你的供应商目录中的这个文件,并确保它在某处包含'method_access_control'。如果没有,那么你在一个旧版本。 https://github.com/schmittjoh/JMSSecurityExtraBundle/blob/master/DependencyInjection/Configuration.php – MDrollette

+0

是的,我正在重新安装捆绑包,现在他们建议。 –