/** * 获取用户权限 * */ public function getAccess() { if (null === $this->_access) { $key = self::CACHE_KEY_ACCESS . strtolower($this->_attrs['username']); $access = self::$_memcache->get($key); if (!$access) { /* @var $daoAccess Dao_Md_Access_Access */ $daoAccess = Tudu_Dao_Manager::getDao('Dao_Md_Access_Access', Tudu_Dao_Manager::DB_MD); $access = $daoAccess->getUserAccess($this->orgId, $this->userId); self::$_memcache->set($key, $access, null, 86400); } $this->_access = new Tudu_Access($access); } return $this->_access; }
/** * (non-PHPdoc) * @see OpenApi_OAuth_Storage_Interface::setRefreshToken() */ public function setRefreshToken($refreshToken, array $data, $timeout = null) { return $this->_memcache->set($this->_makeRefreshTokenKey($refreshToken), $data, null, $timeout); }
/** * Store data at the storage * * @param string $key * @param mixed $value * @param int $expire */ public function set($key, $value, $expire = null) { return $this->_storage->set($key, $value, 0, $expire); }
/** * 获取系统提示数据 */ public function getTips() { if ($this->_tips) { return $this->_tips; } $lang = !empty($this->_user->option['language']) ? $this->_user->option['language'] : 'zh_CN'; $this->_tips = $this->cache->get('TUDU-TIPS-' . $lang); if (!$this->_tips) { $dataFile = $this->options['data']['path'] . '/' . 'tudu_tips-' . $lang . '.xml'; if (!file_exists($dataFile) || !is_readable($dataFile)) { return null; } $xml = @simplexml_load_file($dataFile); if (!$xml) { return null; } foreach ($xml as $tip) { if (!isset($tip->id)) { continue; } if (isset($tip->expiretime) && strtotime($tip->expiretime) < time()) { continue; } $item = array(); foreach ($tip as $k => $val) { $item[$k] = (string) $val; } $this->_tips[$item['id']] = $item; } $this->cache->set('TUDU-TIPS-' . $lang, $this->_tips, null, 86400); } return $this->_tips; }