thisism-a
thisism-a

Reputation: 19

Symfony: Add new user roles?

My task is to develop an application that helps accountants and their clients communicate with each other. The website is going to have 3 types of users; an admin, an accountant and a client.

I just created my user entity with

php bin/console make:user

but how do I add "accountant" and "client" user roles other than ROLE_USER?

Upvotes: 1

Views: 208

Answers (1)

geoB
geoB

Reputation: 4716

In security.yaml you can do this:

...
    role_hierarchy:
        ROLE_ACCOUNTANT: ROLE_USER
        ROLE_CLIENT: ROLE_USER

So that when new users are added you can specify which flavor of ROLE_.

Upvotes: 1

Related Questions