wip: zen
This commit is contained in:
parent
f14cd4a3db
commit
cc590364e9
4 changed files with 9 additions and 7 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue