doctrine2 - zf2 acl doctrine 2 -


actually using zend framework 2, looking way implement performant acl strategy based on database.

the whole idea directly filter dql queries depending on logged in user, , it's permissions.

i found implementation of mecanisme in symfony 2 http://symfony.com/doc/current/cookbook/security/acl_advanced.html, in case 1 table seems store each user if has access single row, can dynamically load allowed rows joining table.

to synthesize,i looking way define access rules entities based on criterias, want able results in single query able ordering, , pagination.

are there zf2 modules resolve case ?

it looks integrating sf2 security component standalone not option: security component symfony 2.0 standalone

you have use doctrine filter load things current member

example of codes adding filter member query :

$em = $sm->get('doctrine.entitymanager.orm_default');   $ormconfig = $sm->get('doctrine.configuration.orm_default');   $ormconfig->addfilter("member", "\patrickcore\script\orm\functional\memberaccessfilter");   //  $currentuser = $membersservice->getcurrentuser();  $uid = $currentuser->getid(); $filter = $em->getfilters()->enable("member"); $filter->setparameter('member', $uid); 

and file \patrickcore\script\orm\functional\memberaccessfilter :

<?php namespace patrickcore\script\orm\functional; use doctrine\orm\mapping\classmetadata,     doctrine\orm\query\filter\sqlfilter;  class memberaccessfilter extends sqlfilter {     public function addfilterconstraint(classmetadata $targetentity, $targettablealias)     {         // check if entity implements localaware interface          if (!$targetentity->reflclass->implementsinterface('\patrickcore\entity\memberaccessaware')) {             return "";         }          return $targettablealias.'.member_id = ' . $this->getparameter('member'); // getparameter applies quoting automatically     } } 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -