2017 © Pedro Peláez
 

symfony-bundle acl-bundle

Providing an easy way to work with the Symfony Security Acl.

image

msi/acl-bundle

Providing an easy way to work with the Symfony Security Acl.

  • Monday, May 16, 2016
  • by massil31
  • Repository
  • 1 Watchers
  • 0 Stars
  • 171 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 5 Versions
  • 2 % Grown

The README.md

ChiliLabs AclBundle

Bundle for Symfony2 providing easy access to the complex ACL subsystem

Latest Stable Version Total Downloads License Build Status Coverage Status SensioLabsInsight, (*1)

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., (*2)

Without this bundle you normally do this (taken from the [ACL docs][1]):, (*3)

// 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:, (*4)

$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., (*5)

Tests

To run the test suite, you need composer., (*6)

$ composer install
$ phpunit

License

ChiliLabs AclBundle is licensed under the MIT license., (*7)

The Versions