Esempio n. 1
0
 /**
  * 架构函数
  * @param array $options 缓存参数
  * @access public
  */
 public function __construct($options = array())
 {
     if (empty($options)) {
         $options = array('table' => C('DATA_CACHE_TABLE'));
     }
     $this->options = $options;
     $this->options['prefix'] = isset($options['prefix']) ? $options['prefix'] : C('DATA_CACHE_PREFIX');
     $this->options['length'] = isset($options['length']) ? $options['length'] : 0;
     $this->options['expire'] = isset($options['expire']) ? $options['expire'] : C('DATA_CACHE_TIME');
     $this->handler = \Any\Db::getInstance();
 }
Esempio n. 2
0
 public static function getModuleAccessList($authId, $module)
 {
     // Db方式
     $db = Db::getInstance(C('RBAC_DB_DSN'));
     $table = array('role' => C('RBAC_ROLE_TABLE'), 'user' => C('RBAC_USER_TABLE'), 'access' => C('RBAC_ACCESS_TABLE'));
     $sql = "select access.node_id from " . $table['role'] . " as role," . $table['user'] . " as user," . $table['access'] . " as access " . "where user.user_id='{$authId}' and user.role_id=role.id and ( access.role_id=role.id  or (access.role_id=role.pid and role.pid!=0 ) ) and role.status=1 and  access.module='{$module}' and access.status=1";
     $rs = $db->query($sql);
     $access = array();
     foreach ($rs as $node) {
         $access[] = $node['node_id'];
     }
     return $access;
 }