dev-master
9999999-devSymfony security extra features
MIT
The Requires
The Development Requires
by Yann Eugoné
Wallogit.com
2017 © Pedro PelĂĄez
Symfony security extra features
``` bash $ composer require yokai/security-extra-bundle:1.0-dev, (*3)
### Enable the bundle in the kernel ``` php <?php // app/AppKernel.php public function registerBundles() { $bundles = [ // ... new Yokai\SecurityExtraBundle\YokaiSecurityExtraBundle(), ]; }
Imagine that you handle an entity named AppBundle\Entity\Article on which you has basic CRUD operations., (*4)
You can imagine what kind of checks you will have to implements to secure your CRUD actions :, (*5)
ROLE_ARTICLE_LIST
ROLE_ARTICLE_SHOW
ROLE_ARTICLE_CREATE
ROLE_ARTICLE_UPDATE
AND if you created this post in the first placeROLE_ARTICLE_DELETE
AND if you created this post in the first placeOK, here is a way to configure it :, (*6)
``` yaml, (*7)
yokai_security_extra: permissions:, (*8)
- attributes: 'browse'
roles: ROLE_ARTICLE_LIST
- attributes: 'details'
subjects: AppBundle\Entity\Article
roles: ROLE_ARTICLE_SHOW
- attributes: 'create'
roles: ROLE_ARTICLE_CREATE
- attributes: 'update'
subjects: AppBundle\Entity\Article
roles: ROLE_ARTICLE_UPDATE
callables: 'isOwnedBy'
- attributes: 'delete'
subjects: AppBundle\Entity\Article
roles: ROLE_ARTICLE_DELETE
callables: 'isOwnedBy'
**note** `isOwnedBy` is a method available on `AppBundle\Entity\Article` that could look like ```php public function isOwnedBy(User $user) { return $this->author === $user; }
todo, (*9)
License can be found here., (*10)
The bundle was originally created by Yann Eugoné., (*11)
See the list of contributors., (*12)
Symfony security extra features
MIT