summaryrefslogtreecommitdiffstats
path: root/model/client4.go
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-04-18 00:06:33 +0900
committerChristopher Speller <crspeller@gmail.com>2017-04-17 11:06:33 -0400
commit742bab6429aeb1b581275da3c06af99fe293baab (patch)
treef5fb57770677d09081061eccbaf23d4a7fab6f9d /model/client4.go
parenta2f5ad0d1422001a0fbbad4dd0004faf5244ea55 (diff)
downloadchat-742bab6429aeb1b581275da3c06af99fe293baab.tar.gz
chat-742bab6429aeb1b581275da3c06af99fe293baab.tar.bz2
chat-742bab6429aeb1b581275da3c06af99fe293baab.zip
APIv4 PUT /users/{user_id}/active (#6118)
Diffstat (limited to 'model/client4.go')
-rw-r--r--model/client4.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go
index 9fda40aca..ad3ff51a4 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -693,6 +693,19 @@ func (c *Client4) UpdateUserRoles(userId, roles string) (bool, *Response) {
}
}
+// UpdateUserActive updates status of a user whether active or not.
+func (c *Client4) UpdateUserActive(userId string, active bool) (bool, *Response) {
+ requestBody := make(map[string]interface{})
+ requestBody["active"] = active
+
+ if r, err := c.DoApiPut(c.GetUserRoute(userId)+"/active", StringInterfaceToJson(requestBody)); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CheckStatusOK(r), BuildResponse(r)
+ }
+}
+
// DeleteUser deactivates a user in the system based on the provided user id string.
func (c *Client4) DeleteUser(userId string) (bool, *Response) {
if r, err := c.DoApiDelete(c.GetUserRoute(userId)); err != nil {