summaryrefslogtreecommitdiff
path: root/pkg/policies/rest.cedar
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/policies/rest.cedar')
-rw-r--r--pkg/policies/rest.cedar51
1 files changed, 11 insertions, 40 deletions
diff --git a/pkg/policies/rest.cedar b/pkg/policies/rest.cedar
index a889684..c6c4f74 100644
--- a/pkg/policies/rest.cedar
+++ b/pkg/policies/rest.cedar
@@ -1,41 +1,12 @@
permit (
- principal == Subject::"*",
- action == Action::"GET",
- resource in Path::"/projects.json"
-);
-
-permit (
- principal == Subject::"gid://User/1",
- action == Action::"GET",
- resource in Path::"/*.json"
-);
-
-permit (
- principal == Subject::"gid://User/1",
- action == Action::"POST",
- resource in Path::"/*.json"
-);
-
-permit (
- principal == Subject::"gid://User/1",
- action == Action::"PUT",
- resource in Path::"/*.json"
-);
-
-permit (
- principal == Subject::"gid://User/1",
- action == Action::"PATCH",
- resource in Path::"/*.json"
-);
-
-permit (
- principal == Subject::"gid://User/1",
- action == Action::"DELETE",
- resource in Path::"/*.json"
-);
-
-permit (
- principal == Subject::"gid://User/1",
- action == Action::"HEAD",
- resource in Path::"/*.json"
-);
+ principal == User::"1",
+ action in [
+ HttpMethod::"GET",
+ HttpMethod::"POST",
+ HttpMethod::"PUT",
+ HttpMethod::"PATCH",
+ HttpMethod::"DELETE",
+ HttpMethod::"HEAD"
+ ],
+ resource
+) when { context.host == "api.example.com" };