polite-traffic-4036
04/08/2024, 4:28 AM{{"error":{"code":404,"status":"Not Found","reason":"Unknown namespace with name \"projects\".","message":"The requested resource could not be found"}
keto.yml
namespaces:
location: "file:///home/ory/keto_namespaces.ts"
keto_namespaces.ts
import { Namespace, Context } from "@ory/keto-namespace-types"
class User implements Namespace {}
class Project implements Namespace {
related: {
owners: User[]
editors: User[]
viewers: User[]
}
permits = {
view: (ctx: Context): boolean =>
this.related.viewers.includes(ctx.subject) ||
this.permits.edit(ctx),
edit: (ctx: Context): boolean =>
this.related.owners.includes(ctx.subject) ||
this.related.editors.includes(ctx.subject),
delete: (ctx: Context): boolean =>
this.permits.edit(ctx)
}
}
This worked when defining the namespaces directly in the keto.yml file.