This commit is contained in:
Frank
2025-10-10 19:49:59 -04:00
parent f14cd4a3db
commit cc590364e9
4 changed files with 9 additions and 7 deletions

View File

@@ -69,7 +69,7 @@ export namespace Actor {
export const assertAdmin = () => {
if (userRole() === "admin") return
throw new Error(`Expected admin user, got ${userRole()}`)
throw new Error(`Action not allowed. Ask your workspace admin to perform this action.`)
}
export function workspace() {

View File

@@ -52,6 +52,7 @@ export namespace Workspace {
name: z.string().min(1).max(255),
}),
async ({ name }) => {
Actor.assertAdmin()
const workspaceID = Actor.workspace()
return await Database.use((tx) =>
tx