// ListUserOpenIDs 返回用户列表
345295
func (user *User) ListUserOpenIDs(nextOpenid ...string) (*OpenidList, error) {
	accessToken, err := user.GetAccessToken()
	if err != nil {
		return nil, err
	}

	uri, _ := url.Parse(userListURL)
	q := uri.Query()
	q.Set("access_token", accessToken)
	if len(nextOpenid) > 0 && nextOpenid[0] != "" {
		q.Set("next_openid", nextOpenid[0])
	}
	uri.RawQuery = q.Encode()

	response, err := util.HTTPGet(uri.String())
	if err != nil {
		return nil, err
	}

	userlist := new(OpenidList)
	err = json.Unmarshal(response, userlist)
	if err != nil {
		return nil, err
	}

	return userlist, nil
}
147215
func (this *Weixinmp) GetUserInfo(openId string) (UserInfo, error) {
	var uinf UserInfo
	url := fmt.Sprintf("%suser/info?lang=zh_CN&openid=%s&access_token=", UrlPrefix, openId)
	// retry
	for i := 0; i < retryNum; i++ {
		token, err := this.AccessToken.Fresh()
		if err != nil {
			if i < retryNum-1 {
				continue
			}
			return uinf, err
		}
		resp, err := http.Get(url + token)
		if err != nil {
			if i < retryNum-1 {
				continue
			}
			return uinf, err
		}
		defer resp.Body.Close()
		data, err := ioutil.ReadAll(resp.Body)
		if err != nil {
			if i < retryNum-1 {
				continue
			}
			return uinf, err
		}
		// has error?
		var rtn response
		if err := json.Unmarshal(data, &rtn); err != nil {
			if i < retryNum-1 {
				continue
			}
			return uinf, err
		}
		// yes
		if rtn.ErrCode != 0 {
			if i < retryNum-1 {
				continue
			}
			return uinf, errors.New(fmt.Sprintf("%d %s", rtn.ErrCode, rtn.ErrMsg))
		}
		// no
		if err := json.Unmarshal(data, &uinf); err != nil {
			if i < retryNum-1 {
				continue
			}
			return uinf, err
		}
		break // success
	}
	return uinf, nil
}
505251
func mainAdminUserList(ctx *cli.Context) error {
	checkAdminUserListSyntax(ctx)

	// Additional command speific theme customization.
	console.SetColor("UserMessage", color.New(color.FgGreen))
	console.SetColor("AccessKey", color.New(color.FgBlue))
	console.SetColor("PolicyName", color.New(color.FgYellow))
	console.SetColor("UserStatus", color.New(color.FgCyan))

	// Get the alias parameter from cli
	args := ctx.Args()
	aliasedURL := args.Get(0)

	// Create a new MinIO Admin Client
	client, err := newAdminClient(aliasedURL)
	fatalIf(err, "Cannot get a configured admin connection.")

	users, e := client.ListUsers()
	fatalIf(probe.NewError(e).Trace(args...), "Cannot list user")

	for k, v := range users {
		printMsg(userMessage{
			op:         "list",
			AccessKey:  k,
			PolicyName: v.PolicyName,
			UserStatus: string(v.Status),
		})
	}
	return nil
}
1050540
func ListLinks(c web.C, w http.ResponseWriter, r *http.Request) {
	account := r.Header.Get("X-Remote-User")
	for _, l := range links {
		if l.Owner == account {
			fmt.Fprintf(w, "%s\n", l.ShortLink)
		}
	}
}
1167408
func (s *BatchUnsuspendUserInput) SetUserIdList(v []*string) *BatchUnsuspendUserInput {
	s.UserIdList = v
	return s
}
140679
func (c *client) UserList() ([]*User, error) {
	var out []*User
	uri := fmt.Sprintf(pathUsers, c.addr)
	err := c.get(uri, &out)
	return out, err
}
1099706
func (r *RepoResource) ListUser(owner string) ([]*Repo, error) {
	repos := []*Repo{}
	path := fmt.Sprintf("/repositories/%s", owner)

	if err := r.client.do("GET", path, nil, nil, &repos); err != nil {
		return nil, err
	}

	return repos, nil
}
1081888
func (api UsersAPI) ListPublicKeys(w http.ResponseWriter, r *http.Request) {
	username := mux.Vars(r)["username"]
	userMgr := user.NewManager(r)
	userobj, err := userMgr.GetByName(username)
	if err != nil {
		http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
		return
	}
	var publicKeys []user.PublicKey

	publicKeys = userobj.PublicKeys

	w.Header().Set("Content-Type", "application/json")
	json.NewEncoder(w).Encode(publicKeys)
}
947477
func (c *FakeUsers) List(opts v1.ListOptions) (result *user.UserList, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootListAction(usersResource, usersKind, opts), &user.UserList{})
	if obj == nil {
		return nil, err
	}

	label, _, _ := testing.ExtractFromListOptions(opts)
	if label == nil {
		label = labels.Everything()
	}
	list := &user.UserList{ListMeta: obj.(*user.UserList).ListMeta}
	for _, item := range obj.(*user.UserList).Items {
		if label.Matches(labels.Set(item.Labels)) {
			list.Items = append(list.Items, item)
		}
	}
	return list, err
}
550386
func (s *userServiceImpl) ListIdentitiesToDeactivate(ctx context.Context, now func() time.Time) ([]repository.Identity, error) {
	since := now().Add(-s.config.GetUserDeactivationInactivityPeriodDays())                                                                        // remove 'n' days from now (default: 31)
	notification := now().Add(s.config.GetUserDeactivationInactivityNotificationPeriodDays() - s.config.GetUserDeactivationInactivityPeriodDays()) // make sure that the notification was sent at least `n` days earlier (default: 7)
	limit := s.config.GetUserDeactivationFetchLimit()

	return s.Repositories().Identities().ListIdentitiesToDeactivate(ctx, since, notification, limit)
}
993697
func List(c *client.Client, appID string) ([]string, error) {
	body, err := c.BasicRequest("GET", fmt.Sprintf("/v1/apps/%s/perms/", appID), nil)

	if err != nil {
		return []string{}, err
	}

	var users api.PermsAppResponse
	if err = json.Unmarshal([]byte(body), &users); err != nil {
		return []string{}, err
	}

	return users.Users, nil
}
941026
func (x *XC) ListPublicKeyIDs(ctx context.Context) ([]string, error) {
	return x.pubring.KeyIDs(), nil
}
1363025
func (a *API) ListUserConfigs(user int) ([]string, error) {
	dst := make([]string, 0)
	url := a.BuildURL("/v2/user/%d/config", user)
	err := a.Get(url, Params{}, &dst)
	return dst, err
}
114514
func (c *identities) List(opts v1.ListOptions) (result *user.IdentityList, err error) {
	var timeout time.Duration
	if opts.TimeoutSeconds != nil {
		timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
	}
	result = &user.IdentityList{}
	err = c.client.Get().
		Resource("identities").
		VersionedParams(&opts, scheme.ParameterCodec).
		Timeout(timeout).
		Do().
		Into(result)
	return
}
409133
func (e *LDAPInterface) ListGroups() ([]string, error) {
	searchRequest := e.groupQuery.LDAPQuery.NewSearchRequest(e.requiredGroupAttributes())
	groups, err := ldaputil.QueryForEntries(e.clientConfig, searchRequest)
	if err != nil {
		return nil, err
	}

	ldapGroupUIDs := []string{}
	for _, group := range groups {
		ldapGroupUID := ldaputil.GetAttributeValue(group, []string{e.groupQuery.QueryAttribute})
		if len(ldapGroupUID) == 0 {
			return nil, fmt.Errorf("unable to find LDAP group UID for %s", group)
		}
		e.cachedGroups[ldapGroupUID] = group
		ldapGroupUIDs = append(ldapGroupUIDs, ldapGroupUID)
	}
	return ldapGroupUIDs, nil
}
1067307
func (a adminAPIHandlers) ListUsers(w http.ResponseWriter, r *http.Request) {
	ctx := newContext(r, w, "ListUsers")

	objectAPI := validateAdminReq(ctx, w, r)
	if objectAPI == nil {
		return
	}

	allCredentials, err := globalIAMSys.ListUsers()
	if err != nil {
		writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)
		return
	}

	data, err := json.Marshal(allCredentials)
	if err != nil {
		writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)
		return
	}

	password := globalServerConfig.GetCredential().SecretKey
	econfigData, err := madmin.EncryptData(password, data)
	if err != nil {
		writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)
		return
	}

	writeSuccessResponseJSON(w, econfigData)
}
81330
func PermsList(appID string, admin bool, results int) error {
	c, appID, err := permsLoad(appID, admin)

	if err != nil {
		return err
	}

	var users []string
	var count int

	if admin {
		if results == defaultLimit {
			results = c.ResponseLimit
		}
		users, count, err = perms.ListAdmins(c, results)
	} else {
		users, err = perms.List(c, appID)
	}

	if err != nil {
		return err
	}

	if admin {
		fmt.Printf("=== Administrators%s", limitCount(len(users), count))
	} else {
		fmt.Printf("=== %s's Users\n", appID)
	}

	sort.Strings(users)

	for _, user := range users {
		fmt.Println(user)
	}

	return nil
}