update all sessions when changing admin permissions instead of deleting
This commit is contained in:
@ -46,6 +46,12 @@ export function getSession(
|
||||
return session;
|
||||
}
|
||||
|
||||
export function updateAllUserSessions(userId: number, options: { permissions: Permissions }) {
|
||||
for (const session of sessions.filter((v) => v.userId == userId)) {
|
||||
session.permissions = options.permissions;
|
||||
}
|
||||
}
|
||||
|
||||
export function deleteSession(sessionId: string | Cookies) {
|
||||
const session = sessionFromId(sessionId);
|
||||
if (session) {
|
||||
@ -54,5 +60,5 @@ export function deleteSession(sessionId: string | Cookies) {
|
||||
}
|
||||
|
||||
export function deleteAllUserSessions(userId: number) {
|
||||
sessions = sessions.filter((v) => v.userId == userId);
|
||||
sessions = sessions.filter((v) => v.userId != userId);
|
||||
}
|
||||
|
Reference in New Issue
Block a user