From 89dc3cb126ba46b486997c433adfdf34982fcc81 Mon Sep 17 00:00:00 2001 From: Rick Batka Date: Mon, 16 Oct 2017 23:50:31 -0400 Subject: [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 --- model/client4.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'model/client4.go') 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} -- cgit v1.2.3-1-g7c22