Installation¶
// config/bundles.php
return [
// ...
AccessControl\Bundle\AccessControlBundle::class => ['all' => true],
];
There is no enabled flag. Registering the bundle is the opt-in, and it is what makes the component take over the authorization entry points.
What registering it changes¶
Immediately, and without touching a line of your code or your configuration:
| Entry point | Before | After |
|---|---|---|
#[IsGranted] |
Security's listener | This component's |
is_granted() in Twig |
Security's extension | This component's |
security.access_control rules |
Security's access map | This component's decision manager |
security.role_hierarchy |
Security | Shared: one tree, both stacks |
| Your voters | Consulted by Security | Consulted here, unchanged |
| Workflow guards | Security's listener | Security's, unless you have no Security |
The answers do not change. Your security.yaml stays byte for byte what it was. See The Two Migrations.
Check it took over¶
Open any page with the profiler on: the Configuration tab of the Access Control panel names which stack answers what. If it still says security where you expected component, the bridge did not take over and you want to know now rather than later. See The Profiler Panel.
One case where it will not install¶
An application using field level ACL in its templates, that is is_granted('EDIT', $post, 'title'), cannot register this bundle: no voter here understands a FieldVote, and rather than answering false, which a template cannot tell from a real refusal, the function raises. See Templates.
If you have no Security at all¶
Everything above still applies, minus the takeovers. Two things need a word:
AbstractController::isGranted()anddenyAccessUnlessGranted()need a trait,- workflow guards need
symfony/security-coreinstalled though never used, see Workflow Guards.
Then tell the component who is asking, since there is no token to read: see Requesters and Actors.
Configuration¶
None is required. Everything has a default, and the settings live under one root key. See Configuration.