Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix: site curator only relevant for curateable path/method #71

Merged
merged 3 commits into from
Oct 4, 2024
Merged
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
4 changes: 0 additions & 4 deletions defaults/site_roles.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@
"SITE_ADMIN_USER"
],
"curator": [
"USER2"
],
"local_team": [
"USER1"
],
"mohccn_network": [
"USER1",
"USER2"
]
}
}
Expand Down
31 changes: 26 additions & 5 deletions permissions_engine/permissions.rego
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,30 @@ datasets := data.calculate.datasets {
else := []


# true if the path and method in the input match something in paths.json
path_method_registered := true {
# true if the path and method in the input match a readable combo in paths.json
readable_method_path := true {
input.body.method = "GET"
object.union(data.calculate.readable_get, data.calculate.curateable_get)[_]
data.calculate.readable_get[_]
}
else := true {
input.body.method = "POST"
object.union(data.calculate.readable_post, data.calculate.curateable_post)[_]
data.calculate.readable_post[_]
}
else := true {
input.body.method = "DELETE"
data.calculate.curateable_delete[_]
}
else := false


# true if the path and method in the input match a curateable combo in paths.json
curateable_method_path := true {
input.body.method = "GET"
data.calculate.curateable_get[_]
}
else := true {
input.body.method = "POST"
data.calculate.curateable_post[_]
}
else := true {
input.body.method = "DELETE"
Expand All @@ -53,7 +69,12 @@ else := true
else := true
{
site_curator
path_method_registered
curateable_method_path
}
else := true
{
site_curator
readable_method_path
}


Expand Down