获取用户拥有角色数据
@param $uid 用户id
@return array 拥有的角色数组
191148
public function getRoleUser($uid) {

        if (empty($this->roleUser)){

            $role_user_data = $this->config['auth_cache'] ? Session::get($this->getRoleUserKey()) : [];

            if (empty($role_user_data) || !is_array($role_user_data)){

                $where = [];
                $where['user_id'] = $uid;
                $role_user_list = Db::name($this->config['role_user'])
                    ->field('role_id')
                    ->where($where)
                    ->select();

                $role_user_data = array_column($role_user_list,'role_id');

                //dump($role_user_data);

                if (empty($role_user_data)) return false;

                if ($this->config['auth_cache'])
                    Session::set($this->getRoleUserKey(),$role_user_data);
            }

            $this->roleUser = $role_user_data;

        }

        return $this->roleUser;
    }
1202899
public static function getCategories($uid, $table)
    {
        $categoryData = array(
            'uid_list' => array(),
            'title_list' => array()
        );

        if ($uid && $table) {
            $queryBuilder = Db::getQueryBuilder($table);
            $categoryRecords = $queryBuilder
                ->add('select', '`sys_category`.`uid`, `sys_category`.`title`')
                ->from('sys_category')
                ->from('sys_category_record_mm')
                ->from($table)
                ->add(
                    'where',
                    '`sys_category`.`uid` = `sys_category_record_mm`.`uid_local`'
                    . ' AND `' . $table . '`.`uid` = `sys_category_record_mm`.`uid_foreign`'
                    . ' AND `' . $table . '`.`uid` = ' . $uid
                    . ' AND `sys_category_record_mm`.`tablenames` ="' . $table . '"'
                )
                ->add('orderBy', '`sys_category_record_mm`.`sorting`')
                ->execute()
                ->fetchAll();

            if (!empty($categoryRecords)) {
                foreach ($categoryRecords as $cat) {
                    $categoryData['uid_list'][] = $cat['uid'];
                    $categoryData['title_list'][] = $cat['title'];
                }
            }
        }

        return $categoryData;
    }
69238
public function getGroup($uid){
        
        $groupIds = $this->getGroupIds($uid);
        
        $groups = DB::table($this->dbTablePrefix . $this->tableGroup)
                    ->where('id' , 'in' , $groupIds)
                    ->where('status' , '1')
                    ->order('sort asc')
                    ->select();
        
        return $groups;
        
    }
437456
public function getGroupIds($uid){
        
        $groupIds = Db::table($this->dbTablePrefix . $this->tableUserGroup)
                    ->where('user_id',$uid)
                    ->column('group_id');
        
        return $groupIds;
    }
1111476
public static function getRootPid($uid = null)
    {
        static $cache = array();
        $ret = null;

        if ($uid === null) {
            #################
            # Current root PID
            #################
            $rootline = self::getRootLine();
            if (!empty($rootline[0])) {
                $ret = $rootline[0]['uid'];
            }
        } else {
            #################
            # Other root PID
            #################
            if (!isset($cache[$uid])) {
                $cache[$uid] = null;
                $rootline    = self::getRootLine($uid);

                if (!empty($rootline[0])) {
                    $cache[$uid] = $rootline[0]['uid'];
                }
            }

            $ret = $cache[$uid];
        }

        return $ret;
    }
1133004
public function serverGetByUid($uid)
  {
    foreach($this->serverList() as $server)
    {
      if($server["virtualserver_unique_identifier"] == $uid) return $server;
    }

    throw new Exception("invalid serverID", 0x400);
  }
672181
function show_user_by_id( $uid )
	{
		$params=array();
		if ( $uid !== NULL ) {
			$this->id_format($uid);
			$params['uid'] = $uid;
		}

		return $this->oauth->get('users/show', $params );
	}
629286
public function getFromGuid( $guid ) {
		$params = array(
			'claim' => $guid,
		);

		$result = $this->api->getRequest( new SimpleRequest( 'wbgetclaims', $params ) );

		$statementSerialization = array_shift( array_shift( $result['claims'] ) );

		return $this->statementDeserializer->deserialize( $statementSerialization );
	}
599846
public function getAllThreadIdsForUser($uid) {
    $query = 'SELECT DISTINCT(thread.id), MAX(thread.updated) ' .
      'FROM {private_message_threads} AS thread ' .
      'JOIN {private_message_thread__members} AS member ' .
      'ON member.entity_id = thread.id AND member.members_target_id = :uid ' .
      'JOIN {private_message_thread__private_messages} AS thread_messages ' .
      'ON thread_messages.entity_id = thread.id ' .
      'JOIN {private_messages} AS messages ' .
      'ON messages.id = thread_messages.private_messages_target_id ' .
      'JOIN {private_message_thread__last_delete_time} AS thread_delete_time ' .
      'ON thread_delete_time.entity_id = thread.id ' .
      'JOIN {pm_thread_delete_time} as owner_delete_time ' .
      'ON owner_delete_time.id = thread_delete_time.last_delete_time_target_id AND owner_delete_time.owner = :uid ' .
      'WHERE owner_delete_time.delete_time <= messages.created ';
    $vars = [':uid' => $uid];

    $query .= 'GROUP BY thread.id ORDER BY MAX(thread.updated) DESC, thread.id';

    $thread_ids = $this->database->query(
      $query,
      $vars
    )->fetchCol();

    return is_array($thread_ids) ? $thread_ids : [];
  }
65351
public function updateGroupUser($uid, $gid) {
		$user = WechatUser::findOne($uid);
		if(!$user) {
			throw new ErrorException('数据查询失败');
		}

		if($user->groupid == $gid) {
			return true;
		}

		$data = $this->getData('/cgi-bin/groups/members/update', [
			'access_token' => $this->getAccessToken(),
		], Json::encode([
			'openid' => $user->openid,
			'to_groupid' => $gid,
		]));

		$result = $this->errcode == 0;
		if($result && $user->group->updateCounters(['count' => -1])) {
			$user->groupid = $gid;
			if($user->save()) {
				$user->refresh();
				return $user->group->updateCounters(['count' => 1]);
			}
		}

		return $result;
	}
679515
private function getDistinctClassnamesFromUids(array $uids)
    {
        $classnames = array();

        try {
            if (0 < count($uids)) {
                // Data protection
                array_walk($uids, function (&$item) {
                            $item = addslashes($item);
                });

                // Getting classnames for provided uids
                $classnames = $this->_em
                        ->getConnection()
                        ->createQueryBuilder()
                        ->select('classname')
                        ->from('content', 'c')
                        ->andWhere("uid IN ('".implode("','", $uids)."')")
                        ->execute()
                        ->fetchAll(\PDO::FETCH_COLUMN);
            }
        } catch (\Exception $e) {
            // Ignoring error
        }

        return array_unique($classnames);
    }
528901
public function getGroups( $uid ) {
        static $groups = [];
        if ( isset($groups[$uid]) )
            return $groups[$uid];
        $user_groups = Db::table( $this->prefix.$this->_config['auth_group_access'] )
            ->alias('a')
            ->join( $this->prefix.$this->_config['auth_group']." g", "g.id=a.group_id" )
            ->where( "a.uid='$uid' and g.status='1'" )
            ->field( 'uid,group_id,title,rules' )->select();
        $groups[$uid] = $user_groups ? $user_groups : [];
        return $groups[$uid];
    }
89963
public function update($uid)
    {
        if (!Input::has('user')) {
            return $this->jsonErrorResponse('"user" is required.');
        }

        $user = Subbly::api('subbly.user')->update($uid, Input::get('user'));

        return $this->jsonResponse(array(
            'user' => $this->presenter->single($user),
        ),
        array(
            'status' => array(
                'code'    => 200,
                'message' => 'User updated',
            ),
        ));
    }
149779
public function getPages($uids, int $languageUid = null): array {
    $pages = [];

    if (is_string($uids)) {
      $uids = GeneralUtility::intExplode(',', $uids, true);
    }

    if ($uids) {
      foreach($uids as $uid) {
        $record = $this->getPage($uid, $languageUid);

        if ($record) {
          $pages[] = $record;
        }
      }
    }

    return $pages;
  }
679313
public function getUserinfo($uid = null)
	{
		$ret = array();
		if (extension_loaded('posix')) {
			if (is_null($uid)) {
				$uid = posix_geteuid();	// get effective userid
			} elseif (is_string($uid)) {
				// username passed?
				$ret = posix_getpwnam($uid);
			}
			if (empty($ret)) {
				$ret = posix_getpwuid($uid);
			}
			$ret['group'] = posix_getgrgid($uid_info['gid']);
			unset($ret['gid']);	// is inside group array
		}
		return $ret;
	}
619340
public function getGroups($uid)
    {
        static $groups = [];
        if (isset($groups[$uid])) {
            return $groups[$uid];
        }
        // 转换表名
        $type = Config::get('database.prefix') ? 1 : 0;
        $auth_group_access = Loader::parseName($this->config['auth_group_access'], $type);
        $auth_group = Loader::parseName($this->config['auth_group'], $type);
        // 执行查询
        $user_groups = Db::view($auth_group_access, 'uid,group_id')
            ->view($auth_group, 'title,rules', "{$auth_group_access}.group_id={$auth_group}.id", 'LEFT')
            ->where("{$auth_group_access}.uid='{$uid}' and {$auth_group}.status='1'")
            ->select();
        $groups[$uid] = $user_groups ?: [];

        return $groups[$uid];
    }
901098
public function searchByUid($uid) {
		$results = $this->ldap->search($this->basedn,
			$this->search_username . '=' . $uid);
		return $results;
	}