@saluzi/saluzi-edu 0.2.48 → 0.2.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -292,6 +292,24 @@ export function resolveOwnedWebSessionId(
|
|
|
292
292
|
): string | null {
|
|
293
293
|
try {
|
|
294
294
|
const db = getDb()
|
|
295
|
+
|
|
296
|
+
// Admin bypass — admin sees all sessions in list views (listSessions),
|
|
297
|
+
// so detail/delete/control resolution must also bypass the visibility
|
|
298
|
+
// check. Otherwise admin sees sessions they cannot open or delete
|
|
299
|
+
// (orphan ACP sessions, other users' sessions). canManageSession still
|
|
300
|
+
// gates destructive actions; control.ts gates on session status.
|
|
301
|
+
const userRow = db
|
|
302
|
+
.query('SELECT role FROM users WHERE id = $userId')
|
|
303
|
+
.get({ $userId: uuid }) as { role: string } | null
|
|
304
|
+
if (userRow?.role === 'admin') {
|
|
305
|
+
if (storeGetSession(sessionId)) return sessionId
|
|
306
|
+
const compatibleCodeSessionId = toCompatibleCodeSessionId(sessionId)
|
|
307
|
+
if (compatibleCodeSessionId && storeGetSession(compatibleCodeSessionId)) {
|
|
308
|
+
return compatibleCodeSessionId
|
|
309
|
+
}
|
|
310
|
+
return sessionId
|
|
311
|
+
}
|
|
312
|
+
|
|
295
313
|
const visibility = isSessionVisibleToUser(sessionId, uuid, db)
|
|
296
314
|
if (visibility) {
|
|
297
315
|
if (!requireWrite || visibility === 'owner' || visibility === 'write') {
|