Skip to content

Instantly share code, notes, and snippets.

@jenkoian
Created March 21, 2016 11:06
Show Gist options
  • Save jenkoian/098695ae18feb8a5c67d to your computer and use it in GitHub Desktop.
Save jenkoian/098695ae18feb8a5c67d to your computer and use it in GitHub Desktop.
Symfony access control with roles
<?php
//...
$container->loadFromExtension(‘security’, [
//...
‘access_control’ => [
[‘path’ => ‘^/content/add’, ‘role’ => ‘add_content’],
[‘path’ => ‘^/content/moderate’, ‘role’ => ‘moderate_content’],
[‘path’ => ‘^/user/edit’, ‘role’ => ‘edit_user’]
],
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment