Skip to content

Commit

Permalink
fix(xo-web): don't delete other user's auth tokens
Browse files Browse the repository at this point in the history
Fixes zammad#17276
  • Loading branch information
julien-f committed Sep 1, 2023
1 parent b2a3014 commit 1046bbd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

> Users must be able to say: “I had this issue, happy to know it's fixed”
- [User] _Forget all connection tokens_ button should not delete other users' tokens, even when current user is an administrator (PR [#7014](https://github.com/vatesfr/xen-orchestra/pull/7014))

### Packages to release

> When modifying a package, add it here with its release type.
Expand All @@ -28,5 +30,6 @@
<!--packages-start-->

- xo-server minor
- xo-web patch

<!--packages-end-->
6 changes: 3 additions & 3 deletions packages/xo-web/src/common/xo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2973,7 +2973,7 @@ export const removeUserAuthProvider = ({ userId, authProviderId }) => {
}

const _signOutFromEverywhereElse = () =>
_call('token.delete', {
_call('token.deleteOwn', {
pattern: {
id: {
__not: cookies.get('token'),
Expand Down Expand Up @@ -3111,7 +3111,7 @@ export const deleteAuthToken = async ({ id }) => {
icon: 'user',
title: _('deleteAuthTokenConfirm'),
})
return _call('token.delete', { tokens: [id] })::tap(subscribeUserAuthTokens.forceRefresh)
return _call('token.deleteOwn', { tokens: [id] })::tap(subscribeUserAuthTokens.forceRefresh)
}

export const deleteAuthTokens = async tokens => {
Expand All @@ -3122,7 +3122,7 @@ export const deleteAuthTokens = async tokens => {
icon: 'user',
title: _('deleteAuthTokensConfirm', { nTokens: tokens.length }),
})
return _call('token.delete', { tokens: tokens.map(token => token.id) })::tap(subscribeUserAuthTokens.forceRefresh)
return _call('token.deleteOwn', { tokens: tokens.map(token => token.id) })::tap(subscribeUserAuthTokens.forceRefresh)
}

export const editAuthToken = ({ description, id }) =>
Expand Down

0 comments on commit 1046bbd

Please sign in to comment.