Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW] API users.logoutOtherClient to logout from other locations #16193

Conversation

jschirrmacher
Copy link
Contributor

Closes #16168

Like discussed with @geekgonecrazy, this PR adds a new API route /users.logoutOtherClients so that this functionality which already exists in the UI (user profile) is available for automation as well.

@jschirrmacher jschirrmacher force-pushed the feature/api-to-logout-from-other-locations branch from 9f618ed to 594ba18 Compare January 10, 2020 11:39
Copy link
Member

@MarcosSpessatto MarcosSpessatto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jschirrmacher First of all, thanks for the PR and for the tests. I left some comments on your PR.

tests/end-to-end/api/01-users.js Outdated Show resolved Hide resolved
tests/end-to-end/api/01-users.js Outdated Show resolved Hide resolved
tests/end-to-end/api/01-users.js Outdated Show resolved Hide resolved
tests/end-to-end/api/01-users.js Show resolved Hide resolved
@jschirrmacher jschirrmacher force-pushed the feature/api-to-logout-from-other-locations branch from 573edfc to d89f0ff Compare January 14, 2020 10:21
@MarcosSpessatto
Copy link
Member

@jschirrmacher can you take a look on the broken tests?

@jschirrmacher
Copy link
Contributor Author

Tests work now as expected

@mrsimpson
Copy link
Collaborator

@MarcosSpessatto Can you please re-evaluate the PR?

@MarcosSpessatto MarcosSpessatto added this to the 3.0.0 milestone Jan 27, 2020
@engelgabriel engelgabriel modified the milestones: 3.0.0, 3.1.0 Mar 6, 2020
@CLAassistant
Copy link

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@rodrigok rodrigok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm suggesting to change from logoutOtherClients to removeOtherTokens since the first one will remove even the token used to execute the API call. The second we use to reset all the other tokens when changing the password introduced by this PR where we added some changes to get the correct session token from the API call as well.

It's not necessary to use Meteor.runAsUser anymore since the same PR, not the API will run in an invocation already containing the session.

The Try Catch is not necessary as well since all the APIs run inside a global Try Catch wich already call the API.v1.failure method with the error.

app/api/server/v1/users.js Outdated Show resolved Hide resolved
tests/end-to-end/api/01-users.js Show resolved Hide resolved
tests/end-to-end/api/01-users.js Outdated Show resolved Hide resolved
tests/end-to-end/api/01-users.js Outdated Show resolved Hide resolved
@rodrigok rodrigok added the documentation: needed Needs addition/changes to documentation label Mar 12, 2020
@MarcosSpessatto MarcosSpessatto added Contain documentation PR and removed documentation: needed Needs addition/changes to documentation labels Mar 13, 2020
@rodrigok rodrigok merged commit 891e164 into RocketChat:develop Mar 13, 2020
ggazzo added a commit to wreiske/Rocket.Chat that referenced this pull request Mar 19, 2020
…4892-wreiske-user-status-bubbles

* 'develop' of github.com:RocketChat/Rocket.Chat: (540 commits)
  [FIX] Show error message if password and confirm password not equal (RocketChat#16247)
  [FIX] Message quote button inside threads (RocketChat#16925)
  Fix wrong imported library meteor/tap:i18n
  lint
  [IMPROVE] User gets feedback when a message has been starred or unstarred (RocketChat#13860)
  [FIX] admin can sort users by email in directory view (RocketChat#15796)
  [FIX] Pinned messages wouldn't collapse (RocketChat#16188)
  [IMPROVE] Added border to page header. (RocketChat#16792)
  [FIX] Correct thread messages display in context bar. (RocketChat#16835)
  [FIX] Public channel cannot be acessed via URL when 'Allow Anonymous Read' is active (RocketChat#16914)
  Fixed Line break incorrectly being called apostrophe (RocketChat#16918)
  [IMPROVE] Context menu autofocus (RocketChat#16915)
  Improve room types usage (RocketChat#16753)
  [NEW] API `users.deactivateIdle` for mass-disabling of idle users (RocketChat#16849)
  [NEW] API to logout from other locations (RocketChat#16193)
  [IMPROVE] Add option to require authentication on user's shield endpoint (RocketChat#16845)
  [FIX] Custom OAuth Bug (RocketChat#16811)
  [FIX] Integrations page pagination (RocketChat#16838)
  reset package-lock to upstream
  Apply suggestions from code review
  ...
ggazzo added a commit that referenced this pull request Mar 20, 2020
…ultiple-users* 'develop' of github.com:RocketChat/Rocket.Chat: (53 commits) [FIX] Show error message if password and confirm password not equal (#16247)  [FIX] Message quote button inside threads (#16925)  Fix wrong imported library meteor/tap:i18n  lint  [IMPROVE] User gets feedback when a message has been starred or unstarred (#13860)  [FIX] admin can sort users by email in directory view (#15796)  [FIX] Pinned messages wouldn't collapse (#16188)  [IMPROVE] Added border to page header. (#16792)  [FIX] Correct thread messages display in context bar. (#16835)  [FIX] Public channel cannot be acessed via URL when 'Allow Anonymous Read' is active (#16914)  Fixed Line break incorrectly being called apostrophe (#16918)  [IMPROVE] Context menu autofocus (#16915)  Improve room types usage (#16753)  [NEW] API `users.deactivateIdle` for mass-disabling of idle users (#16849)  [NEW] API to logout from other locations (#16193)  [IMPROVE] Add option to require authentication on user's shield endpoint (#16845)  [FIX] Custom OAuth Bug (#16811)  [FIX] Integrations page pagination (#16838)  reset package-lock to upstream  Apply suggestions from code review  ...
@rodrigok rodrigok changed the title [NEW] API to logout from other locations [NEW] API users.logoutOtherClient to logout from other locations Mar 26, 2020
@sampaiodiego sampaiodiego mentioned this pull request Apr 9, 2020
@mrsimpson mrsimpson deleted the feature/api-to-logout-from-other-locations branch December 7, 2020 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New API route to logout from all other sessions
6 participants