Advertisement
RalfEggert

ACL-Service Factory

Dec 13th, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. namespace User\Acl;
  2.  
  3. use Zend\ServiceManager\FactoryInterface;
  4. use Zend\ServiceManager\ServiceLocatorInterface;
  5.  
  6. class ServiceFactory implements FactoryInterface
  7. {
  8.     public function createService(ServiceLocatorInterface $serviceLocator)
  9.     {
  10.         $config    = $serviceLocator->get('Config');
  11.         $cache     = $serviceLocator->get('Application\Cache\Objects');
  12.         $auth      = $serviceLocator->get('User\Authentication\Service');
  13.         $role      = $auth->hasIdentity() ? $auth->getIdentity()->getGroup() : 'guest';
  14.         $acl       = new Service($role, $config['acl'], $cache);
  15.         return $acl;
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement