ocket8888 commented on a change in pull request #4196: TP: Provides the ability
to view all users for a given role
URL: https://github.com/apache/trafficcontrol/pull/4196#discussion_r375927643
##########
File path: traffic_ops/client/user.go
##########
@@ -36,8 +37,26 @@ func (to *Session) Users() ([]tc.User, error) {
// GetUsers returns all users accessible from current user
func (to *Session) GetUsers() ([]tc.User, ReqInf, error) {
- route := apiBase + "/users.json"
- resp, remoteAddr, err := to.request("GET", route, nil)
+ route := apiBase + "/users"
+ resp, remoteAddr, err := to.request(http.MethodGet, route, nil)
+ reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr:
remoteAddr}
+ if err != nil {
+ return nil, reqInf, err
+ }
+ defer resp.Body.Close()
+
+ var data tc.UsersResponse
+ if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
+ return nil, reqInf, err
+ }
+
+ return data.Response, reqInf, nil
Review comment:
yes exactly
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services