Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions contrib/cat-videos-example/keto.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
version: v0.6.0-alpha.1
version: v0.10.0-alpha.0

log:
level: debug

namespaces:
- id: 0
name: videos
location: file://./contrib/cat-videos-example/namespaces.ts

dsn: memory

Expand Down
19 changes: 19 additions & 0 deletions contrib/cat-videos-example/namespaces.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Context, Namespace } from "@ory/keto-namespace-types"

class User implements Namespace {
related: {}
}

class Video implements Namespace {
related: {
owners: User[]
parents: Video[]
}

permits = {
view: (ctx: Context) => this.permits.isOwner(ctx),
isOwner: (ctx: Context) =>
this.related.owners.includes(ctx.subject) ||
this.related.parents.traverse((p) => p.permits.isOwner(ctx)),
}
}
32 changes: 32 additions & 0 deletions contrib/cat-videos-example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions contrib/cat-videos-example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"@ory/keto-namespace-types": "file:../namespace-type-lib"
}
}
4 changes: 2 additions & 2 deletions contrib/cat-videos-example/relation-tuples/cats1_owner.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"$schema": "../../../.schema/relation_tuple.schema.json",
"namespace": "videos",
"object": "/cats/1.mp4",
"relation": "owner",
"relation": "parent",
"subject_set": {
"namespace": "videos",
"object": "/cats",
"relation": "owner"
"relation": ""
}
}

This file was deleted.

4 changes: 2 additions & 2 deletions contrib/cat-videos-example/relation-tuples/cats2_owner.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"$schema": "../../../.schema/relation_tuple.schema.json",
"namespace": "videos",
"object": "/cats/2.mp4",
"relation": "owner",
"relation": "parent",
"subject_set": {
"namespace": "videos",
"object": "/cats",
"relation": "owner"
"relation": ""
}
}
11 changes: 0 additions & 11 deletions contrib/cat-videos-example/relation-tuples/cats2_view.json

This file was deleted.

2 changes: 1 addition & 1 deletion internal/driver/config/namespace_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func watchTarget(ctx context.Context, target string, handler eventHandler, log *
return errors.WithStack(err)
}
if info.IsDir() {
watcher, err = watcherx.WatchDirectory(ctx, targetUrl.Path, eventCh)
watcher, err = watcherx.WatchDirectory(ctx, urlx.GetURLFilePath(targetUrl), eventCh)
} else {
watcher, err = watcherx.Watch(ctx, targetUrl, eventCh)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/driver/config/opl_config_namespace_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func newOPLConfigWatcher(ctx context.Context, c *Config, target string) (*oplCon
}

switch targetUrl.Scheme {
case "file":
case "file", "":
return nw, watchTarget(ctx, target, nw, c.l)
case "http", "https", "base64":
file, err := c.Fetcher().Fetch(target)
Expand Down