不存在安裝Symfony2 cmf後,當我試圖查看管理/儀表盤,我有以下錯誤:功能「is_granted」在SonataAdminBundle
The function "is_granted" does not exist in SonataAdminBundle :: standard_layout.html.twig at line 95
不存在安裝Symfony2 cmf後,當我試圖查看管理/儀表盤,我有以下錯誤:功能「is_granted」在SonataAdminBundle
The function "is_granted" does not exist in SonataAdminBundle :: standard_layout.html.twig at line 95
我與相當多的時間掙扎,太。以下是如何解決這個問題:
在app/config
文件夾,例如在SecurityBundle添加到app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
// support for the admin
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
);
// ...
}
創建security.yml
本演示內容:
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
providers:
in_memory:
memory:
users:
user: { password: userpass, roles: [ 'ROLE_USER' ] }
admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
pattern: ^/
anonymous: ~
http_basic:
realm: "Secured Demo Area"
access_control:
#- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
#- { path: ^/_internal/secure, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 }
,並加載它,它的app/config/config.yml
:
imports:
- { resource: security.yml }
爲我工作。
正如反饋到別的誰可能面臨這個問題:
極致的解決方案工作。顯然,用戶必須按照
中所述提供http://symfony.com/doc/master/cmf/tutorials/creating-cms-using-cmf-and-sonata.html
什麼巫術是這個!像魅力一樣工作 – Dheeraj 2016-01-21 09:51:58