예제 #1
0
 /**
  * PM dependency map to load up
  */
 public function getPdm()
 {
     $pdm = null;
     $cache = CalemFactory::getDataCacheManager();
     $pdmInfo = $cache->load('pdm');
     if ($pdmInfo) {
         if ($this->pdmUpToDate($pdmInfo)) {
             $pdm = $pdmInfo['pdm'];
         }
     }
     if (!$pdm) {
         //Create PDM and save it.
         $timestamp = CalemText::getServerDateTime();
         $pdm = $this->buildPdm();
         $cache->save(array('timestamp' => $timestamp, 'pdm' => $pdm), 'pdm');
     }
     return $pdm;
 }
예제 #2
0
 public function load()
 {
     $dbo = new CalemAclGroupDbo();
     $rows = $dbo->getAll();
     $data = array();
     foreach ($rows as $row) {
         $dataRow = array();
         foreach ($row as $key => $val) {
             $dataRow[] = $val;
         }
         $data[] = $dataRow;
         $this->addParent($row['id'], $row['parent_group_id']);
     }
     //Searializing the object
     $group = array('data' => $data, 'parentMap' => $this->parentMap);
     $cache = CalemFactory::getDataCacheManager();
     $cache->save($group, 'acl_group');
 }
예제 #3
0
        $lang = $setting['lang'];
        $loadmode = $setting['loadmode'];
    }
}
if (!$cont) {
    $logger->error("sid=" . $sid . " not found, service not provided");
    die("Session is not valid, service is not provided.");
}
$path = _CALEM_DIR_ . 'custom/';
$uid = $userRow['id'];
$gid = $userRow['acl_group_id'];
$bulk = array();
//Adding personalized customization (form, view, search, modules, etc for OOB, custom, group and user)
$vs = $_CALEM_conf['calem_cutsom_set'];
//Getting groups data to load.
$cache = CalemFactory::getDataCacheManager();
$data = $cache->load('acl_group');
$cacheList = array("CalemData['acl_group']=" . json_encode($data) . CALEM_LFCR);
$parentGroups = $data['parentMap'][$gid];
foreach ($parentGroups as $grp) {
    $bulk = addCustomInfo($path . 'group/', $grp, $vs, $bulk);
}
//Add group self.
$bulk = addCustomInfo($path . 'group/', $gid, $vs, $bulk);
//Add user self
$bulk = addCustomInfo($path . 'user/', $uid, $vs, $bulk);
//Add system customization: tables, dropdowns, and text
$locale = isset($lang) && strlen($lang) > 0 ? '_' . $lang : '';
$bulk = addCustomInfo($path . 'global/', 'custom.metadata', array('.js'), $bulk);
$bulk = addCustomInfo($path . 'global/', 'custom.dropdown', array('.js'), $bulk);
$bulk = addCustomInfo($path . 'global/', 'custom' . $locale . '.message', array('.js'), $bulk);
 /**
  * Assemble a view's acl based on current user, group and default system info.
  */
 public function getCustomInfo($id, $uid, $gid, $excludeUser, $excludeMyGroup, $stopWhenFound)
 {
     //Creating a customInfo for result.
     $customInfo = $this->getEmptyCustomInfo($id);
     $foundIt = false;
     //Aggregate user
     if (!$excludeUser) {
         list($foundIt, $customInfo) = $this->aggregate($id, $uid, $customInfo, true);
         if ($stopWhenFound && $foundIt) {
             return $customInfo;
         }
     }
     //Aggregate group
     if (!$excludeMyGroup) {
         list($foundIt, $customInfo) = $this->aggregate($id, $gid, $customInfo, false);
         if ($stopWhenFound && $foundIt) {
             return $customInfo;
         }
     }
     $cache = CalemFactory::getDataCacheManager();
     $cachedGroups = $cache->load('acl_group');
     $parents = $cachedGroups['parentMap'][$gid];
     if ($this->logger->isDebugEnabled()) {
         $this->logger->debug("gid=" . $gid . ", parents=" . var_export($parents, true));
     }
     if ($parents) {
         foreach ($parents as $parent) {
             list($foundIt, $customInfo) = $this->aggregate($id, $parent, $customInfo, false);
             if ($stopWhenFound && $foundIt) {
                 return $customInfo;
             }
         }
     }
     return $customInfo;
 }