根据用户id获取用户组,返回值为数组
@param  uid int     用户id
@return array       用户所属的用户组 array(
array('uid'=>'用户id','group_id'=>'用户组id','title'=>'用户组名称','rules'=>'用户组拥有的规则id,多个,号隔开'),
...)
496935
public function getGroups($uid) {
        static $groups = array();
        if (isset($groups[$uid]))
            return $groups[$uid];
        $user_groups = M()
            ->table($this->_config['AUTH_GROUP_ACCESS'] . ' a')
            ->where("a.uid='$uid' and g.status='1'")
            ->join($this->_config['AUTH_GROUP']." g on a.group_id=g.id")
            ->field('uid,group_id,title,rules')->select();
        $groups[$uid]=$user_groups?:array();
        return $groups[$uid];
    }
815709
function guid() {
    let curr = (new Date()).valueOf().toString();
    return [
        '4b534c46',  // Fixed first group. and a trick
        rand16Num(4),
        '4' + rand16Num(3),  // The first character of 3rd group is '4'.
        rand16Num(4),
        curr.substring(0, 12)
    ].join('-');
}
971601
protected function createInsert($uid)
    {
        $field1 = rand(1, 2);
        $field2 = rand(0, 1);
        return [
            'user_id' => $uid,
            'name'    => $this->faker->text(20),
            'value'   => '{"field_1":"' . $field1 . '","field_2":"' . $field2 . '"}'
        ];
    }
850048
public function my_getUidInfo($uid)
    {
        $node_name = $this->searchUid($uid);
        if ($node_name) {
            if (!isset($this->client[$node_name])) return null;
            $token = $this->client[$node_name]->getUidInfo($uid);
            $fdInfo = $this->client[$node_name]->getTokenResult($token);
            return $fdInfo;
        }
        return null;
    }
106991
protected function getAuthList($uid,$type) {
        static $_authList = array(); //保存用户验证通过的权限列表
        $t = implode(',',(array)$type);
        if (isset($_authList[$uid.$t])) {
            return $_authList[$uid.$t];
        }
        if( $this->_config['auth_type']==2 && isset($_SESSION['_auth_list_'.$uid.$t])){
            return $_SESSION['_auth_list_'.$uid.$t];
        }

        //读取用户所属用户组
        $groups = $this->getGroups($uid);
        $ids = array();//保存用户所属用户组设置的所有权限规则id
        foreach ($groups as $g) {
            $ids = array_merge($ids, explode(',', trim($g['rules'], ',')));
        }
        $ids = array_unique($ids);
        if (empty($ids)) {
            $_authList[$uid.$t] = array();
            return array();
        }

        $map=array(
            'id'=>array('in',$ids),
            'type'=>$type,
            'status'=>1,
        );
        //读取用户组所有权限规则
        $rules = Db::table($this->prefix.$this->_config['auth_rule'])->where($map)->field('condition,name')->select();

        //循环规则，判断结果。
        $authList = array();   //
        foreach ($rules as $rule) {
            if (!empty($rule['condition'])) { //根据condition进行验证
                $user = $this->getUserInfo($uid);//获取用户信息,一维数组

                $command = preg_replace('/\{(\w*?)\}/', '$user[\'\\1\']', $rule['condition']);
                //dump($command);//debug
                @(eval('$condition=(' . $command . ');'));
                if ($condition) {
                    $authList[] = strtolower($rule['name']);
                }
            } else {
                //只要存在就记录
                $authList[] = strtolower($rule['name']);
            }
        }
        $_authList[$uid.$t] = $authList;
        if($this->_config['auth_type']==2){
            //规则列表结果保存到session
            $_SESSION['_auth_list_'.$uid.$t]=$authList;
        }
        return array_unique($authList);
    }
316765
public static function getUidByClientId($client_id)
    {
        $data = static::select(array('uid'), array('client_id'=>array($client_id)));
        foreach ($data as $local_ip => $buffer_array) {
            foreach ($buffer_array as $local_port => $items) {
                //$items = ['connection_id'=>['uid'=>x, 'group'=>[x,x..], 'session'=>[..]], 'client_id'=>[..], ..];
                foreach ($items as $info) {
                    return $info['uid'];
                }
            }
        }
    }
798041
public function getGroupIds()
    {
        $ids = array();

        /* @var $group \Sokil\UserBundle\Entity\Group */
        foreach ($this->getGroups() as $group) {
            $ids[] = $group->getId();
        }

        return $ids;
    }
305684
public static function getAllUidList()
    {
        $data = static::select(array('uid'));
        $uid_map = array();
        foreach ($data as $local_ip => $buffer_array) {
            foreach ($buffer_array as $local_port => $items) {
                //$items = ['connection_id'=>['uid'=>x, 'group'=>[x,x..], 'session'=>[..]], 'client_id'=>[..], ..];
                foreach ($items as $connection_id => $info) {
                    if (!empty($info['uid'])) {
                        $uid_map[$info['uid']] = $info['uid'];
                    }
                }
            }
        }
        return $uid_map;
    }
182031
def get_uids_from_request(self):
        
        uids = self.request.get("uids", "")
        if isinstance(uids, basestring):
            uids = uids.split(",")
        unique_uids = collections.OrderedDict().fromkeys(uids).keys()
        return filter(api.is_uid, unique_uids)
440105
public boolean[] getIssuerUniqueID() {
        if (info == null)
            return null;
        try {
            UniqueIdentity id = (UniqueIdentity)info.get(
                                 X509CertInfo.ISSUER_ID);
            if (id == null)
                return null;
            else
                return (id.getId());
        } catch (Exception e) {
            return null;
        }
    }
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;
    }
1281804
@Basic
    @Column(name = "UIDENT", unique = true, nullable = false, length=255)
    public String getUid()
    {
        return this.uid;
    }
449427
public static function getCommonGroups($uid, $pid)
	{
		// Get the groups the visiting user
		$xgroups = self::getGroups($uid, 'all', 1);

		$usersgroups = array();
		if (!empty($xgroups))
		{
			foreach ($xgroups as $group)
			{
				if ($group->regconfirmed)
				{
					$usersgroups[] = $group->cn;
				}
			}
		}

		// Get the groups of the profile
		$pgroups = self::getGroups($pid, 'all', 1);

		// Get the groups the user has access to
		$profilesgroups = array();
		if (!empty($pgroups))
		{
			foreach ($pgroups as $group)
			{
				if ($group->regconfirmed)
				{
					$profilesgroups[] = $group->cn;
				}
			}
		}

		// Find the common groups
		return array_intersect($usersgroups, $profilesgroups);
	}
862448
public function getByUID($uid)
    {
        return array_filter($this->getComponents(), function ($item) use ($uid) {
            if (!$itemUid = $item->select('UID')) {
                return false;
            }
            $itemUid = current($itemUid)->getValue();

            return $uid === $itemUid;
        });
    }
474381
def chuid(name, uid):
    '''
    
    '''
    if not isinstance(uid, int):
        raise SaltInvocationError('uid must be an integer')
    pre_info = info(name)
    if not pre_info:
        raise CommandExecutionError('User \'{0}\' does not exist'.format(name))
    if uid == pre_info['uid']:
        return True
    _dscl(
        ['/Users/{0}'.format(name), 'UniqueID', pre_info['uid'], uid],
        ctype='change'
    )
    # dscl buffers changes, sleep 1 second before checking if new value
    # matches desired value
    time.sleep(1)
    return info(name).get('uid') == uid
246422
@SuppressWarnings("unchecked")
    private String[] getGroupIds(WSCredential cred) {
        Collection<String> ids = null;
        if (cred != null) {
            try {
                ids = cred.getGroupIds();
            } catch (CredentialExpiredException e) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Caught exception getting the group access ids: " + e);
                }
            } catch (CredentialDestroyedException e) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Caught exception getting the group access ids: " + e);
                }
            }
            if (ids != null) {
                return ids.toArray(new String[ids.size()]);
            }
        }
        return null;
        // TODO if ignoreCase is Collection, then lower case the groupids
    }
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 );
	}