project-a / acl-bundle
Providing an easy way to work with the Symfony Security Acl.
Installs: 1 412
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 5
Forks: 4
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.0
- doctrine/common: ~2.2
- symfony/framework-bundle: ~2.3
- symfony/security: ~2.3
Requires (Dev)
- doctrine/doctrine-bundle: ~1.0
- doctrine/orm: ~2.2
- symfony/browser-kit: ~2.3
- symfony/expression-language: ~2.4
- symfony/finder: ~2.3
- symfony/security-bundle: ~2.3
Suggests
- doctrine/mongodb-odm: Allows you to remove Acl entries automatically. (When using MongoDB for Acl)
- doctrine/orm: Allows you to remove Acl entries automatically. (When using ORM for Acl)
This package is not auto-updated.
Last update: 2019-08-20 21:56:59 UTC
README
Bundle for Symfony2 providing easy access to the complex ACL subsystem
Description
This Symfony 2 Bundle provides an easy api to the Security/ACL component and an eventlistener for automatic ACL cleanup upon removal of domain objects. The installation is simple and by default does not change any behavior of your application.
Without this bundle you normally do this (taken from the ACL docs):
// creating the ACL $aclProvider = $container->get('security.acl.provider'); $objectIdentity = ObjectIdentity::fromDomainObject($domainObject); $acl = $aclProvider->createAcl($objectIdentity); // retrieving the security identity of the currently logged-in user $tokenStorage = $container->get('security.token_storage'); $user = $tokenStorage->getToken()->getUser(); $securityIdentity = UserSecurityIdentity::fromAccount($user); // grant owner access $acl->insertObjectAce($securityIdentity, MaskBuilder::MASK_OWNER); $aclProvider->updateAcl($acl);
With this bundle you can simplify it to:
$tokenStorage = $container->get('security.token_storage'); $user = $tokenStorage->getToken()->getUser(); $aclManager = $container->get('projecta_acl.manager'); $aclManager->manageObjectAces() ->grant($domainObject, MaskBuilder::MASK_OWNER, $user);
Documentation
The latest documentation can be found on aclbundle.chililabs.org.
Tests
To run the test suite, you need composer.
$ composer install
$ phpunit
License
ChiliLabs AclBundle is licensed under the MIT license.