feat: add cerbos access control
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { RoleSchema } from "../access/role.ts";
|
||||
import { AvatarSchema } from "../avatar.ts";
|
||||
import { ContactSchema } from "../contact.ts";
|
||||
import { makeSchemaParser } from "../database.ts";
|
||||
import { NameSchema } from "../name.ts";
|
||||
import { RoleSchema } from "./role.ts";
|
||||
import { StrategySchema } from "./strategies.ts";
|
||||
|
||||
export const AccountSchema = z.object({
|
||||
@@ -18,10 +18,8 @@ export const AccountSchema = z.object({
|
||||
roles: z.array(RoleSchema).default([]),
|
||||
});
|
||||
|
||||
export const AccountDocumentSchema = AccountSchema.omit({ roles: true }).extend({ roles: z.array(z.string()) });
|
||||
|
||||
export const toAccountDocument = makeSchemaParser(AccountDocumentSchema);
|
||||
export const toAccountDocument = makeSchemaParser(AccountSchema);
|
||||
export const fromAccountDocument = makeSchemaParser(AccountSchema);
|
||||
|
||||
export type Account = z.infer<typeof AccountSchema>;
|
||||
export type AccountDocument = z.infer<typeof AccountDocumentSchema>;
|
||||
export type AccountDocument = z.infer<typeof AccountSchema>;
|
||||
|
||||
Reference in New Issue
Block a user