ACL Manager for Symfony2
PHP
Switch branches/tags
Nothing to show
Pull request Compare This branch is 42 commits behind Problematic:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
DependencyInjection
Domain
Model
Resources/config
.gitignore
ProblematicAclManagerBundle.php
README.md

README.md

<?php

$comment = new Comment(); // create some entity
// ... do work on entity

$em->persist($comment);
$em->flush(); // entity must be persisted and flushed before AclManager can act on it (needs identifier)
$aclManager = $this->get('problematic.acl_manager');

$aclManager->addPermission($comment, $userEntity, MaskBuilder::MASK_OWNER);
$aclManager->revokePermission($comment, $userEntity, MaskBUILDER::MASK_DELETE);
$aclManager->revokeAllPermissions($comment, $userEntity);

$aclManager->deleteAclFor($comment);
$em->remove($comment);
$em->flush();

If you'll be doing work on a lot of entities, use AclManager#preloadAcls():

<?php

$products = $repo->findAll();

$aclManager = $this->get('problematic.acl_manager');
$aclManager->preloadAcls($products);

// ... carry on