Browse Source

Add get groups of a user

master
harture 7 years ago
parent
commit
ef9b693092
  1. 8
      users.go

8
users.go

@ -11,6 +11,7 @@ const (
userPath = "/auth/admin/realms/:realm/users"
userCountPath = userPath + "/count"
userIDPath = userPath + "/:id"
groupsPath = userIDPath + "/groups"
resetPasswordPath = userIDPath + "/reset-password"
sendVerifyEmailPath = userIDPath + "/send-verify-email"
executeActionsEmailPath = userIDPath + "/execute-actions-email"
@ -52,6 +53,13 @@ func (c *Client) GetUser(accessToken string, realmName, userID string) (UserRepr
return resp, err
}
// GetGroupsOfUser get the groups of the user.
func (c *Client) GetGroupsOfUser(accessToken string, realmName, userID string) ([]GroupRepresentation, error) {
var resp = []GroupRepresentation{}
var err = c.get(accessToken, &resp, url.Path(groupsPath), url.Param("realm", realmName), url.Param("id", userID))
return resp, err
}
// UpdateUser updates the user.
func (c *Client) UpdateUser(accessToken string, realmName, userID string, user UserRepresentation) error {
return c.put(accessToken, url.Path(userIDPath), url.Param("realm", realmName), url.Param("id", userID), body.JSON(user))

Loading…
Cancel
Save