Skip to content

Commit

Permalink
[backend/frontend] Fix Kill all session button in the user overview (#…
Browse files Browse the repository at this point in the history
…7837)

Co-authored-by: Souad Hadjiat <[email protected]>
  • Loading branch information
CelineSebe and SouadHadjiat authored Aug 7, 2024
1 parent 8ac5be1 commit b368e1d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,10 @@ type Session = {

interface UserProps {
data: User_user$key;
refetch: () => void;
}

const User: FunctionComponent<UserProps> = ({ data }) => {
const User: FunctionComponent<UserProps> = ({ data, refetch }) => {
const classes = useStyles();
const { t_i18n, nsdt, fsd, fldt } = useFormatter();
const { me } = useAuth();
Expand Down Expand Up @@ -258,6 +259,7 @@ const User: FunctionComponent<UserProps> = ({ data }) => {
onCompleted: () => {
setKilling(false);
handleCloseKillSession();
refetch();
},
});
}
Expand All @@ -281,6 +283,7 @@ const User: FunctionComponent<UserProps> = ({ data }) => {
onCompleted: () => {
setKilling(false);
handleCloseKillSessions();
refetch();
},
});
};
Expand Down
4 changes: 3 additions & 1 deletion opencti-platform/opencti-graphql/src/database/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,14 @@ export const killSession = async (id) => {
};

export const killUserSessions = async (userId) => {
const { store } = applicationSession;
const sessions = await findUserSessions(userId);
const sessionsIds = sessions.map((s) => s.id);
const killedSessions = [];
for (let index = 0; index < sessionsIds.length; index += 1) {
const sessionId = sessionsIds[index];
const killedSession = await killSession(sessionId);
const sessId = sessionId.split(store.prefix)[1];
const killedSession = await killSession(sessId);
killedSessions.push(killedSession);
}
return killedSessions;
Expand Down

0 comments on commit b368e1d

Please sign in to comment.