This commit is contained in:
Frank
2025-10-08 18:59:41 -04:00
parent d18b6673e6
commit 5b1fd7e539
7 changed files with 79 additions and 72 deletions

View File

@@ -1,4 +1,5 @@
import { Context } from "./context"
import { UserRole } from "./schema/user.sql"
import { Log } from "./util/log"
export namespace Actor {
@@ -21,6 +22,7 @@ export namespace Actor {
userID: string
workspaceID: string
accountID: string
role: (typeof UserRole)[number]
}
}
@@ -80,4 +82,12 @@ export namespace Actor {
}
throw new Error(`actor of type "${actor.type}" is not associated with an account`)
}
export function userID() {
return Actor.assert("user").properties.userID
}
export function userRole() {
return Actor.assert("user").properties.role
}
}