summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-22 18:05:44 -0600
committermo khan <mo@mokhan.ca>2025-07-22 18:05:44 -0600
commite1eb7946a1aeffe3e8300792bf70dafbcd92f965 (patch)
tree05df1b5c85e2af374ef4e68bf9315fbd32e21df2
parentd62c1aeb3032e0384373395ea2bc785d8ee584a9 (diff)
chore: load schema and relationships via relationships.yaml file
-rw-r--r--Makefile7
-rw-r--r--etc/authzd/relationships.yaml12
-rw-r--r--etc/authzd/schema.zed (renamed from etc/authzd/spice.schema)0
3 files changed, 17 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index a0b4653..4018647 100644
--- a/Makefile
+++ b/Makefile
@@ -52,7 +52,7 @@ run-image: clean build-image
lint:
@go tool yamlfmt --lint -exclude vendor .
- @$(ZED_CMD) validate etc/authzd/spice.schema
+ @$(ZED_CMD) validate etc/authzd/schema.zed
tidy:
@go get -u ./...
@@ -61,7 +61,10 @@ tidy:
@go tool yamlfmt -exclude vendor .
db-schema-load:
- @$(ZED_CMD) schema write etc/authzd/spice.schema
+ @$(ZED_CMD) schema write etc/authzd/schema.zed
db-schema:
@$(ZED_CMD) schema read
+
+db-seed:
+ @$(ZED_CMD) import etc/authzd/relationships.yaml
diff --git a/etc/authzd/relationships.yaml b/etc/authzd/relationships.yaml
new file mode 100644
index 0000000..261ec36
--- /dev/null
+++ b/etc/authzd/relationships.yaml
@@ -0,0 +1,12 @@
+schemaFile: "./schema.zed"
+relationships: >-
+ sparkle:1#author@user:mokhax
+
+ sparkle:1#reader@user:tanuki
+assertions:
+ assertTrue:
+ - "sparkle:1#write@user:mokhax"
+ - "sparkle:1#read@user:mokhax"
+ - "sparkle:1#read@user:tanuki"
+ assertFalse:
+ - "sparkle:1#write@user:tanuki"
diff --git a/etc/authzd/spice.schema b/etc/authzd/schema.zed
index 8a98ab1..8a98ab1 100644
--- a/etc/authzd/spice.schema
+++ b/etc/authzd/schema.zed