feat: allow session permission updates (#22070)

This commit is contained in:
Tommy D. Rossi 2026-04-12 00:14:30 +02:00 • committed by GitHub
commit d62ec7776e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -273,6 +273,7 @@ export const SessionRoutes = lazy(() =>
"json",
z.object({
title: z.string().optional(),
permission: Permission.Ruleset.optional(),
time: z
.object({
archived: z.number().optional(),
@ -283,10 +284,17 @@ export const SessionRoutes = lazy(() =>
async (c) => {
const sessionID = c.req.valid("param").sessionID
const updates = c.req.valid("json")
const current = await Session.get(sessionID)
if (updates.title !== undefined) {
await Session.setTitle({ sessionID, title: updates.title })
}
if (updates.permission !== undefined) {
await Session.setPermission({
sessionID,
permission: Permission.merge(current.permission ?? [], updates.permission),
})
}
if (updates.time?.archived !== undefined) {
await Session.setArchived({ sessionID, time: updates.time.archived })
}