Reputation: 1
I use FosUserBundle
and SonataUserBundle
for my Symfony2
project.
I've got error message:
The service "sonata.user.editable_role_builder" has a dependency on a non-existent parameter `security.role_hierarchy.roles`
Upvotes: 0
Views: 324
Reputation: 11040
The answer is really simple, you have forgotten to create a security.yml containing the role hierachy.
I think you have skipped step 4 of installing FOSUserBundle (see last part of configuration).
Below is a minimal example of the configuration necessary to use the FOSUserBundle in your application:
# app/config/security.yml
security:
providers:
fos_userbundle:
id: fos_user.user_provider.username
encoders:
FOS\UserBundle\Model\UserInterface: sha512
firewalls:
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_provider: form.csrf_provider
logout: true
anonymous: true
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN }
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
Upvotes: 2