Browse Source

client: accept roles in response for ListUser

Fixes #5046
Anthony Romano 9 years ago
parent
commit
c9ce92f635
1 changed files with 7 additions and 1 deletions
  1. 7 1
      client/auth_user.go

+ 7 - 1
client/auth_user.go

@@ -36,6 +36,12 @@ type User struct {
 	Revoke   []string `json:"revoke,omitempty"`
 	Revoke   []string `json:"revoke,omitempty"`
 }
 }
 
 
+// userListEntry is the user representation given by the server for ListUsers
+type userListEntry struct {
+	User  string `json:"user"`
+	Roles []Role `json:"roles"`
+}
+
 type UserRoles struct {
 type UserRoles struct {
 	User  string `json:"user"`
 	User  string `json:"user"`
 	Roles []Role `json:"roles"`
 	Roles []Role `json:"roles"`
@@ -194,7 +200,7 @@ func (u *httpAuthUserAPI) ListUsers(ctx context.Context) ([]string, error) {
 	}
 	}
 
 
 	var userList struct {
 	var userList struct {
-		Users []User `json:"users"`
+		Users []userListEntry `json:"users"`
 	}
 	}
 
 
 	if err = json.Unmarshal(body, &userList); err != nil {
 	if err = json.Unmarshal(body, &userList); err != nil {