Closed snasphysicist closed 1 year ago
@snasphysicist This bug appears to be fixed. I'm able to take the current example at https://www.ory.sh/docs/keto/guides/userset-rewrites and load it with image oryd/keto:v0.11.1-alpha.0
without error.
// namespaces.keto.ts
import { Namespace, SubjectSet, Context } from "@ory/keto-namespace-types"
class User implements Namespace {
related: {
manager: User[]
}
}
class Group implements Namespace {
related: {
members: (User | Group)[]
}
}
class Folder implements Namespace {
related: {
parents: (File | Folder)[]
viewers: SubjectSet<Group, "members">[]
}
permits = {
view: (ctx: Context): boolean =>
this.related.viewers.includes(ctx.subject) ||
this.related.parents.traverse((p) => p.permits.view(ctx)),
}
}
class File implements Namespace {
related: {
parents: (File | Folder)[]
viewers: (User | SubjectSet<Group, "members">)[]
owners: (User | SubjectSet<Group, "members">)[]
}
// Some comment
permits = {
view: (ctx: Context): boolean =>
this.related.parents.traverse((p) => p.permits.view(ctx)) ||
this.related.viewers.includes(ctx.subject) ||
this.related.owners.includes(ctx.subject),
edit: (ctx: Context) => this.related.owners.includes(ctx.subject),
}
}
Thanks for the heads up Zach! Closing this as resolved for now, but feel free to chime up if you are still having trouble @snasphysicist
Preflight checklist
Describe the bug
Trying to configure namespaces from https://www.ory.sh/docs/keto/guides/userset-rewrites using the latest Docker instance of Keto will fail with
Reproducing the bug
In addition to the below configuration, you'll need this namespace ts file (based on https://www.ory.sh/docs/keto/guides/userset-rewrites)
Then run the following docker commands, replacing the paths containing
/home/ssmith/Scratchpad/keto/local/*
with your own directories containing the configuration asketo-configuration-local.yaml
(for/cfg/
) and the namespace ts asketo-ts-configuration-local.ts
(forns
).Finally, make requests to this Keto server using this Python script:
The requests will fail with 404s (namespace not found) and you will see the log messages below among Keto's log entries.
Relevant log output
Relevant configuration
Version
Version: v0.10.0-alpha.0 / Build Commit: 52259a30d0be0257f1bb7ef591ae769808450230 / Build Timestamp: 2022-09-27T13:05:05Z
On which operating system are you observing this issue?
Linux
In which environment are you deploying?
Docker
Additional Context
If I remove the import line it seems to work, so I think the example ts file in https://www.ory.sh/docs/keto/guides/userset-rewrites just needs updating, however I cannot find the right place in this repository to update it.