diff options
author | Rick Batka <rick.batka@gmail.com> | 2017-10-16 23:50:31 -0400 |
---|---|---|
committer | Chris <ccbrown112@gmail.com> | 2017-10-16 20:50:31 -0700 |
commit | 89dc3cb126ba46b486997c433adfdf34982fcc81 (patch) | |
tree | 57ed40c1c193aeec17cea8ab7f7e52d63e44fad4 /model | |
parent | a649602fc373615665ae2eaec95a4e9063eb699d (diff) | |
download | chat-89dc3cb126ba46b486997c433adfdf34982fcc81.tar.gz chat-89dc3cb126ba46b486997c433adfdf34982fcc81.tar.bz2 chat-89dc3cb126ba46b486997c433adfdf34982fcc81.zip |
[PLT-7396] Add the ability to revoke user sessions in System Console > Users #7493 (#7623)
* add endpoint and tests for revoking all sessions for a user
* fix failing test build
Diffstat (limited to 'model')
-rw-r--r-- | model/client4.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go index a7ee3df86..941145043 100644 --- a/model/client4.go +++ b/model/client4.go @@ -901,6 +901,16 @@ func (c *Client4) RevokeSession(userId, sessionId string) (bool, *Response) { } } +// RevokeAllSessions revokes all sessions for the provided user id string. +func (c *Client4) RevokeAllSessions(userId string) (bool, *Response) { + if r, err := c.DoApiPost(c.GetUserRoute(userId)+"/sessions/revoke/all", ""); err != nil { + return false, BuildErrorResponse(r, err) + } else { + defer closeBody(r) + return CheckStatusOK(r), BuildResponse(r) + } +} + // AttachDeviceId attaches a mobile device ID to the current session. func (c *Client4) AttachDeviceId(deviceId string) (bool, *Response) { requestBody := map[string]string{"device_id": deviceId} |