Skip to content

Commit 6ef72f2

Browse files
committed
add updatehistory namespace to keto
1 parent 8ce11a9 commit 6ef72f2

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

charts/hub-permissions/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type: application
1818
# This is the chart version. This version number should be incremented each time you make changes
1919
# to the chart and its templates, including the app version.
2020
# Versions are expected to follow Semantic Versioning (https://semver.org/)
21-
version: 0.4.3
21+
version: 0.4.4
2222

2323
# This is the version number of the application being deployed. This version number should be
2424
# incremented each time you make changes to the application. Versions are not expected to

charts/hub-permissions/policies/namespaces.keto.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,29 @@ class Customer implements Namespace {
8585
}
8686
}
8787

88+
class UpdateHistory implements Namespace {
89+
related: {
90+
owners: User[]
91+
editors: User[]
92+
viewers: User[]
93+
parents: Mint[]
94+
}
95+
96+
permits = {
97+
view: (ctx: Context): boolean =>
98+
this.related.viewers.includes(ctx.subject) ||
99+
this.related.parents.traverse((parent) => parent.permits.view(ctx)) ||
100+
this.permits.edit(ctx),
101+
edit: (ctx: Context): boolean =>
102+
this.related.editors.includes(ctx.subject) ||
103+
this.related.parents.traverse((parent) => parent.permits.edit(ctx)) ||
104+
this.permits.delete(ctx),
105+
delete: (ctx: Context): boolean =>
106+
this.related.owners.includes(ctx.subject) ||
107+
this.related.parents.traverse((parent) => parent.permits.delete(ctx)),
108+
}
109+
}
110+
88111
class Mint implements Namespace {
89112
related: {
90113
owners: User[]

0 commit comments

Comments
 (0)