Skip to content

guilleferrer/ProblematicAclManagerBundle

 
 

Repository files navigation

<?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

About

ACL Manager for Symfony2

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%