ahmed-ghiloubi/acl-bundle
最新稳定版本:4.0
Composer 安装命令:
composer require ahmed-ghiloubi/acl-bundle
包简介
Providing an easy way to work with the Symfony Security Acl.
关键字:
README 文档
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.
统计信息
- 总下载量: 201
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-15