I'm trying to learn symfony by creating a simple project. I began by creatin a dashboard for the admin.
This administrator have the right to create a type of users called "Proprietaire", once this "proprieraire" is connected he can create another type of users "Simple user".
I tried to manage login for admin using FOSUserBundle and i get it done.
The problem now is how to create "proprietaire" type user using a form from the admin page? and how to do the same for creating "simple" type user from "proprietaire" page ?
I have three roles : ROLE_ADMIN, ROLE_PROP and ROLE_SIMPLE
my security.yml file :
# app/config/security.yml
security: encoders: FOS\UserBundle\Model\UserInterface: bcrypt
role_hierarchy:
ROLE_PROP: ROLE_USER
ROLE_ADMIN: ROLE_PROP
providers:
fos_userbundle:
id: fos_user.user_provider.username
firewalls:
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
# if you are using Symfony < 2.8, use the following config instead:
# 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: ^/safeparking/admin, role: ROLE_ADMIN }
- { path: ^/safeparking, role: IS_AUTHENTICATED_ANONYMOUSLY }
I'm using Symfon 2.8.5 so PUGXMultiUserBundle isn't a solution for me.