public function __construct(StorageInterface $storage, AdapterInterface $adapter, Container $container)
 {
     parent::__construct($storage, $adapter);
     $this->container = $container;
     if (!$this->container->profiles) {
         $this->container->profiles = new ArrayObject();
     }
 }
 public function __construct(Storage\StorageInterface $storage = null, Adapter\AdapterInterface $adapter = null, SessionConfig $sessionConfig, ResponseInterface $response, RequestInterface $request)
 {
     parent::__construct($storage, $adapter);
     if (!$response instanceof Response) {
         $response = new Response();
     }
     if (!$request instanceof Request) {
         $request = new Request();
     }
     $this->response = $response;
     $this->request = $request;
     $this->sessionConfig = $sessionConfig;
 }
Example #3
0
 /**
  * Registriert die Module aus der DB mit Zend/Auth
  * Setzt die Rechte der Gruppen
  *
  * @param $sm
  */
 public function __construct($sm)
 {
     $authSessionStorage = new Session('AUTH_IDENTITY');
     parent::__construct($authSessionStorage);
     $em = $sm->get('Doctrine\\ORM\\EntityManager');
     $acl = new ZendAcl();
     // add roles
     foreach ($em->getRepository('Auth\\Entity\\Role')->findBy(array(), array('parentId' => 'ASC')) as $role) {
         if ($role->parent) {
             $parentName = $role->parent->name;
         } else {
             $parentName = null;
         }
         $acl->addRole(new GenericRole($role->name), $parentName);
     }
     // add resources + action
     foreach ($em->getRepository('Auth\\Entity\\Resource')->findBy(array(), array('modul' => 'DESC')) as $resource) {
         $ressouceName = $resource->modul;
         if ($resource->action) {
             $ressouceName .= '/' . $resource->action;
         }
         if ($resource->subAction) {
             $ressouceName .= '/' . $resource->subAction;
         }
         $acl->addResource(new GenericResource($ressouceName));
     }
     unset($ressouceName);
     // deny all
     $acl->deny(null);
     // add permissions
     foreach ($em->getRepository('Auth\\Entity\\Permission')->findAll() as $permission) {
         // allow
         $permissionName = $permission->resource->modul;
         if ($permission->resource->action) {
             $permissionName .= '/' . $permission->resource->action;
         }
         if ($permission->resource->subAction) {
             $permissionName .= '/' . $permission->resource->subAction;
         }
         $acl->allow($permission->gruppe->name, $permissionName);
     }
     // register identity
     if (!$this->hasIdentity()) {
         // register as gast
         $benutzer = new Benutzer();
         $benutzer->setUsername('Unbekannter User');
         $benutzer->setId(0);
         $benutzer->setLoggedIn(false);
         $gruppe = new Role();
         $gruppe->id = 2;
         $gruppe->name = 'Gast';
         $gruppe->supervisor = 0;
         $benutzer->setGruppe($gruppe);
         if (!$benutzer) {
             throw new \Exception('Gastbenutzer mit der ID -1 nicht vorhanden - bitte direkt in der Datenbank anlegen');
         }
         $this->getStorage()->write($benutzer);
     }
     // register acl in navigation
     \Zend\View\Helper\Navigation\AbstractHelper::setDefaultAcl($acl);
     \Zend\View\Helper\Navigation\AbstractHelper::setDefaultRole($this->getIdentity()->getGruppe()->name);
     $this->acl = $acl;
     $this->sm = $sm;
     $this->em = $em;
     return $this;
 }
 /**
  * @param EventManager $eventManager
  * @param EntityManager|null $entityManager
  * @param Storage\StorageInterface|null $storageInterface
  * @param Adapter\AdapterInterface|null $adapterInterface
  */
 public function __construct(EventManager $eventManager, EntityManager $entityManager, Storage\StorageInterface $storageInterface = null, Adapter\AdapterInterface $adapterInterface = null)
 {
     parent::__construct($storageInterface, $adapterInterface);
     $this->entityManager = $entityManager;
     $this->eventManager = $eventManager;
 }
Example #5
0
 public function __construct(EntityManager $entityManager, StorageInterface $storage, AdapterInterface $adapter)
 {
     parent::__construct($storage, $adapter);
     $this->entityManager = $entityManager;
 }
Example #6
0
 /**
  * Constructor
  *
  * @param   ServiceLocatorInterface $serviceLocator
  * @param   StorageInterface        $storage
  * @param   AdapterInterface        $adapter
  */
 public function __construct(ServiceLocatorInterface $serviceLocator, StorageInterface $storage = null, AdapterInterface $adapter = null)
 {
     $this->setServiceLocator($serviceLocator);
     parent::__construct($storage, $adapter);
 }
 public function __construct()
 {
     $callbackAdapter = $this->createCallbackAdapter();
     parent::__construct(null, $callbackAdapter);
 }
 function __construct(StorageInterface $storage = null, AdapterInterface $adapter = null)
 {
     parent::__construct($storage, $adapter);
 }