ListUsers gets a list of users from UAA with the given username and (if provided) origin. NOTE: that this is a paginated response and we are only currently returning the first page of users. This will mean, if no origin is passed and there are more than 100 users with the given username, only the fi
(userName, origin string)
| 125 | // the given username, only the first 100 will be returned. For our current purposes, this is |
| 126 | // more than enough, but it would be a problem if we ever need to get all users with a username. |
| 127 | func (client Client) ListUsers(userName, origin string) ([]User, error) { |
| 128 | filter := fmt.Sprintf(`userName eq "%s"`, userName) |
| 129 | |
| 130 | if origin != "" { |
| 131 | filter = fmt.Sprintf(`%s and origin eq "%s"`, filter, origin) |
| 132 | } |
| 133 | |
| 134 | request, err := client.newRequest(requestOptions{ |
| 135 | RequestName: internal.ListUsersRequest, |
| 136 | Header: http.Header{ |
| 137 | "Content-Type": {"application/json"}, |
| 138 | }, |
| 139 | Query: url.Values{ |
| 140 | "filter": {filter}, |
| 141 | }, |
| 142 | }) |
| 143 | if err != nil { |
| 144 | return nil, err |
| 145 | } |
| 146 | |
| 147 | var usersResponse paginatedUsersResponse |
| 148 | response := Response{ |
| 149 | Result: &usersResponse, |
| 150 | } |
| 151 | |
| 152 | err = client.connection.Make(request, &response) |
| 153 | if err != nil { |
| 154 | return nil, err |
| 155 | } |
| 156 | |
| 157 | var users []User |
| 158 | for _, user := range usersResponse.Resources { |
| 159 | users = append(users, User(user)) |
| 160 | } |
| 161 | |
| 162 | return users, nil |
| 163 | } |
| 164 | |
| 165 | func (client *Client) UpdatePassword(userGUID string, oldPassword string, newPassword string) error { |
| 166 | requestBody := map[string]interface{}{ |
nothing calls this directly
no test coverage detected