Symfony2 cmfをインストールした後、管理者/ダッシュボードを表示しようとすると、次のエラーが発生します。
関数「is_granted」は、SonataAdminBundle::standard_layout.html.twigの95行目には存在しません。
Symfony2 cmfをインストールした後、管理者/ダッシュボードを表示しようとすると、次のエラーが発生します。
関数「is_granted」は、SonataAdminBundle::standard_layout.html.twigの95行目には存在しません。
私もかなりの時間苦労しました。修正方法は次のとおりです。
SecurityBundleをに追加しますapp/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
// support for the admin
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
);
// ...
}
たとえば、次のデモコンテンツを使用して、フォルダにを作成security.yml
します。app/config
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 }
それは私のために働いた。
この問題に直面する可能性のある他の人へのフィードバックと同じように:
acmeのソリューションは機能します。どうやら、ユーザーはで説明されているように提供されなければなりません
http://symfony.com/doc/master/cmf/tutorials/creating-cms-using-cmf-and-sonata.html