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 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊