[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
This commit is contained in:
Rick Batka
2017-10-16 23:50:31 -04:00
committed by Chris
parent a649602fc3
commit 89dc3cb126
3 changed files with 75 additions and 0 deletions

View File

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