2012-06-27 33 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

是的,我正在重新安裝捆綁包,現在他們建議。 –