Documentation

Define roles in code

Before a role can be used, it needs to be defined in a bundle.

Static roles

Static roles are added with an XML file called roles.xml and placed in Resources/config/roles:

Resources/config/roles/roles.xml

1
2
3
4
5
6
7
8
9
<?xml version="1.0" encoding="UTF-8" ?>
<roles>
<role>
<name>ROLE_ADMIN</name>
<label>Administrator</label>
<description></description>
<hidden>0</hidden>
</role>
</roles>

Dynamic roles

For dynamic roles the event "integrated_roles.configure" is fired. Add a listener to this event to add dynamic roles.