Пример #1
0
 protected function _checkPermission($aKeys)
 {
     if (self::$_oConfig->uodo->enabled) {
         //sprawdza z podanych kluczy do których użytkownik nie ma dostępu?
         $key = md5(serialize($aKeys));
         $idUser = self::$_oPermission->getUserId();
         //tworzenie keszu
         $oCache = new Common_Cache_Cache();
         $oTag = new Common_Cache_Tag();
         $oTag->setTags(array('permission'));
         //@todo to powinna być stała
         $oCache->setLifetime(86400);
         //@todo ustawić to jakoś w konfigu na np. 99999999
         $oCache->setSerialize(true);
         $sId = $oCache->getId(get_class($this), 'perm-response-abst', array($key, $idUser));
         //pobieranie/tworzenie danych
         $aResult = $oCache->load($sId);
         if ($aResult == false) {
             $aResult = array();
             foreach ($aKeys as $sField) {
                 if (!self::$_oPermission->checkPermission($sField, Acl_Model_Table_ZasobTyp::FIELD_READ)) {
                     $aResult[] = $sField;
                 }
             }
             $oCache->save($aResult, $sId, $oTag->getTags());
         }
     } else {
         $aResult = array();
     }
     return $aResult;
 }
Пример #2
0
 public function checkPermission(array &$aData)
 {
     //inicjalizacja keszu
     $key = md5(serialize(array_keys($aData)));
     if (self::$_oConfig->uodo->enable) {
         $idUser = parent::$_oPermission->getUserId();
     } else {
         $aUser = Zend_Auth::getInstance()->getIdentity();
         $idUser = $aUser['user_id'];
     }
     //tworzenie keszu
     $oCache = new Common_Cache_Cache();
     $oTag = new Common_Cache_Tag();
     $oTag->setTags(array('permission'));
     //@todo to powinna być stała
     $oCache->setLifetime(86400);
     //@todo ustawić to jakoś w konfigu na np. 99999999
     $oCache->setSerialize(true);
     $sId = $oCache->getId(get_class($this), 'perm-response-form', array($key, $idUser));
     //pobieranie/tworzenie danych
     $aResult = $oCache->load($sId);
     if ($aResult == false) {
         $aResult = $this->_schema($aData);
         $oCache->save($aResult, $sId, $oTag->getTags());
     }
     $aData = $this->_setValue($aData, $aResult);
 }
Пример #3
0
 public function checkPermission($aParams)
 {
     $aKeys = $this->_getKeys($aParams);
     $key = md5(serialize($aKeys));
     //$idUser = Zend_Auth::getInstance()->getIdentity()->user_id;
     $idUser = self::$_oPermission->getUserId();
     //tworzenie keszu
     $oCache = new Common_Cache_Cache();
     $oTag = new Common_Cache_Tag();
     $oTag->setTags(array('permission'));
     //@todo to powinna być stała
     $oCache->setLifetime(86400);
     //@todo ustawić to jakoś w konfigu na np. 99999999
     $oCache->setSerialize(true);
     $sId = $oCache->getId(get_class($this), 'perm-request', array($key, $idUser));
     //pobieranie/tworzenie danych
     $aAllowKeys = $oCache->load($sId);
     if ($aAllowKeys == false) {
         $aAllowKeys = $this->_getAllowedKeys($aParams);
         $oCache->save($aAllowKeys, $sId, $oTag->getTags());
     }
     return $this->_cp($aAllowKeys, $aParams);
 }
Пример #4
0
 protected function _getCachedFileContent()
 {
     $oCache = new Common_Cache_Cache();
     $oTag = new Common_Cache_Tag();
     $oTag->setTags(array('javascript'));
     //@todo to powinna być stała
     $oCache->setLifetime(1);
     //@todo ustawić to jakoś w konfigu na np. 99999999
     $oCache->setSerialize(false);
     $sId = $oCache->getId(get_class($this), 'js-load', array());
     $sResult = $oCache->load($sId);
     if ($sResult != false) {
         if ($oCache->getSerialize()) {
             $sResult = unserialize($sResult);
         }
     } else {
         $sResult = $this->_getFileContent();
         $sNewResult = $oCache->getSerialize() ? serialize($sResult) : $sResult;
         $oCache->save($sNewResult, $sId, $oTag->getTags());
     }
     return $sResult;
 }