doudui2229 2017-12-19 13:29
浏览 58
已采纳

Sonata Admin Exception:变量“adminPool”不存在

After upgrading to a newer version of SonataAdminBundle and SonataUserBundle I get this exception when clicking the link Forgotten password? in the login page:

CRITICAL - Uncaught PHP Exception Twig_Error_Runtime: "Variable "adminPool" does not exist." at /home/luca/Sites/redken_cms/vendor/sonata-project/user-bundle/src/Resources/views/Admin/Security/Resetting/request.html.twig line 31

These are my composer package versions:

sonata-project/admin-bundle              3.29.0  The missing Symfony Admin ...
sonata-project/block-bundle              3.9.0   Symfony SonataBlockBundle
sonata-project/cache                     2.0.1   Cache library
sonata-project/core-bundle               3.8.0   Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.3.1   Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.0.2   Doctrine2 behavioral exten...
sonata-project/doctrine-orm-admin-bundle 3.3.0   Symfony Sonata / Integrate...
sonata-project/easy-extends-bundle       2.3.0   Symfony SonataEasyExtendsB...
sonata-project/exporter                  1.8.0   Lightweight Exporter library
sonata-project/media-bundle              3.10.0  Symfony SonataMediaBundle
sonata-project/notification-bundle       3.2.0   Symfony SonataNotification...
sonata-project/user-bundle               4.0.0   Symfony SonataUserBundle
symfony/symfony                          v2.8.32 The Symfony PHP framework

These are my settings in config.yml:

sonata_user:
    security_acl: true
    manager_type: orm # can be orm or mongodb

    class:
        user: Application\Sonata\UserBundle\Entity\User
        group: Application\Sonata\UserBundle\Entity\Group

fos_user:
    db_driver:      orm # can be orm or odm
    firewall_name:  main
    user_class:     Application\Sonata\UserBundle\Entity\User

    group:
        group_class:   Application\Sonata\UserBundle\Entity\Group
        group_manager: sonata.user.orm.group_manager                    # If you're using doctrine orm (use sonata.user.mongodb.group_manager for mongodb)

    service:
        user_manager: sonata.user.orm.user_manager                      # If you're using doctrine orm (use sonata.user.mongodb.user_manager for mongodb)

    from_email:
        address: "%mailer_from_address%"
        sender_name: "%mailer_from_sender_name%"

And these are my settings in security.yml:

security:
    role_hierarchy:
        ROLE_ADMIN:       [ROLE_USER, ROLE_SONATA_ADMIN]
        ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
        SONATA:
            - ROLE_SONATA_PAGE_ADMIN_PAGE_EDIT  # if you are using acl then this line must be commented

    # https://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
    providers:
        fos_userbundle:
            id: fos_user.user_provider.username

    firewalls:
        # disables authentication for assets and the profiler, adapt it according to your needs
        dev:
            pattern:  ^/(_(profiler|wdt)|css|images|js)/
            security: false

        # -> custom firewall for the admin area of the URL
        admin:
            pattern:            /admin(.*)
            context:            user
            form_login:
                provider:       fos_userbundle
                login_path:     /admin/login
                use_forward:    false
                check_path:     /admin/login_check
                failure_path:   null
            logout:
                path:           /admin/logout
                target:         /admin/login
            anonymous:          true

        # -> end custom configuration

    encoders:
        FOS\UserBundle\Model\UserInterface: sha512

    acl:
        connection: default

    access_control:
        # Admin login page needs to be accessed without credential
        - { path: ^/admin/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/login_check$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }

        # Secured part of the site
        # This config requires being logged for the whole site and having the admin role for the admin part.
        # Change these rules to adapt them to your needs
        - { path: ^/admin/, role: [ROLE_ADMIN, ROLE_SONATA_ADMIN] }

Am I missing something in the configuration?

  • 写回答

1条回答 默认 最新

  • doudou2121 2017-12-20 09:48
    关注

    It seems it was a bug fixed in version 4.0.1. Running composer update this morning fixed it:

    https://github.com/sonata-project/SonataUserBundle/releases/tag/4.0.1

    enter image description here

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 寻找一位有逆向游戏盾sdk 应用程序经验的技术
  • ¥15 请问有用MZmine处理 “Waters SYNAPT G2-Si QTOF质谱仪在MSE模式下采集的非靶向数据” 的分析教程吗
  • ¥50 opencv4nodejs 如何安装
  • ¥15 adb push异常 adb: error: 1409-byte write failed: Invalid argument
  • ¥15 nginx反向代理获取ip,java获取真实ip
  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页
  • ¥15 376.1电表主站通信协议下发指令全被否认问题
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥15 复杂网络,变滞后传递熵,FDA