Symfony access_control 管理员不工作

Symfony access_control for admin not working

我的密码是安全的

security:
  access_control:
    - { path: '^/(%app.locales%)/profile/messages', roles: [ROLE_ADMIN]}

  role_hierarchy:
    ROLE_ADMIN: [ROLE_USER]

用户具有 ROLE_ADMIN 角色,但访问被拒绝。如果我更改代码:

security:
  access_control:
    - { path: '^/(%app.locales%)/profile/messages', roles: [ROLE_USER]}

  role_hierarchy:
    ROLE_ADMIN: [ROLE_USER]

一切都好。我可以访问。我哪里出错了?

问题是我通过数据库更改了角色。为了应用它,必须注销并登录。