Пример #1
0
 /**
  * Nastavuje opravneni pro podsekci projektu
  *
  * @param Zend_Acl $acl ACL objekt
  * @param Zend_Auth_Storage_Session $identity Objekt s identitou
  */
 private function _projectAcl($acl, $identity)
 {
     $aclModel = new Model_Acl();
     $dbData = $aclModel->getAllPerms($identity->email);
     foreach ($dbData as $aclData) {
         $perms = unserialize($aclData['permission']);
         foreach ($perms as $resource => $perm) {
             if (!$acl->has($aclData['idproject'] . '|' . $resource)) {
                 $acl->add(new Zend_Acl_Resource($aclData['idproject'] . '|' . $resource));
                 if ($perm & self::READ) {
                     $acl->allow($identity->email, $aclData['idproject'] . '|' . $resource, $this->_read);
                 }
                 if ($perm & self::CREATE) {
                     $acl->allow($identity->email, $aclData['idproject'] . '|' . $resource, $this->_create);
                 }
                 if ($perm & self::MANAGE) {
                     $acl->allow($identity->email, $aclData['idproject'] . '|' . $resource, $this->_manage);
                 }
                 $this->_resources[] = $aclData['idproject'] . '|' . $resource;
             }
         }
     }
 }