project-a / acl-bundle
此包已被废弃,不再维护。未建议替代包。
提供与Symfony Security Acl轻松工作的便捷方式。
v1.1.0
2015-09-10 21:28 UTC
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
为Symfony2提供的访问复杂ACL子系统的包
描述
此Symfony 2 Bundle提供了一个易于使用的API来访问Security/ACL组件,并在删除域对象时自动清理ACL的事件监听器。安装简单,默认情况下不会更改应用程序的任何行为。
没有这个包,你通常会这样做(来自ACL文档)
// 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);
有了这个包,你可以简化为
$tokenStorage = $container->get('security.token_storage'); $user = $tokenStorage->getToken()->getUser(); $aclManager = $container->get('projecta_acl.manager'); $aclManager->manageObjectAces() ->grant($domainObject, MaskBuilder::MASK_OWNER, $user);
文档
最新的文档可以在aclbundle.chililabs.org找到。
测试
要运行测试套件,你需要composer。
$ composer install
$ phpunit
许可
ChiliLabs AclBundle在MIT许可下授权。