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