diff --git a/charts/hub-permissions/Chart.yaml b/charts/hub-permissions/Chart.yaml index 8ad40e6..afb0fc5 100644 --- a/charts/hub-permissions/Chart.yaml +++ b/charts/hub-permissions/Chart.yaml @@ -18,7 +18,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.4.3 +version: 0.4.4 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/hub-permissions/policies/namespaces.keto.ts b/charts/hub-permissions/policies/namespaces.keto.ts index 466afc0..1f73688 100644 --- a/charts/hub-permissions/policies/namespaces.keto.ts +++ b/charts/hub-permissions/policies/namespaces.keto.ts @@ -85,6 +85,29 @@ class Customer implements Namespace { } } +class UpdateHistory implements Namespace { + related: { + owners: User[] + editors: User[] + viewers: User[] + parents: Mint[] + } + + permits = { + view: (ctx: Context): boolean => + this.related.viewers.includes(ctx.subject) || + this.related.parents.traverse((parent) => parent.permits.view(ctx)) || + this.permits.edit(ctx), + edit: (ctx: Context): boolean => + this.related.editors.includes(ctx.subject) || + this.related.parents.traverse((parent) => parent.permits.edit(ctx)) || + this.permits.delete(ctx), + delete: (ctx: Context): boolean => + this.related.owners.includes(ctx.subject) || + this.related.parents.traverse((parent) => parent.permits.delete(ctx)), + } +} + class Mint implements Namespace { related: { owners: User[]