APIv4 PUT /users/{user_id}/active (#6118)

Этот коммит содержится в:
Saturnino Abril
2017-04-18 00:06:33 +09:00
коммит произвёл Christopher Speller
родитель a2f5ad0d14
Коммит 742bab6429
3 изменённых файлов: 88 добавлений и 0 удалений

Просмотреть файл

@@ -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 {