Skip to content

Commit

Permalink
docs: Add missing OPA rules for Trino batched API (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernauer authored Jan 2, 2024
1 parent 02dedc4 commit f6b6290
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,24 @@ data:
default allow = false
# Allow non-batched access
allow {
is_admin
}
# Allow batched access
extended[i] {
some i
input.action.filterResources[i]
is_admin
}
# Corner case: filtering columns is done with a single table item, and many columns inside
extended[i] {
some i
input.action.operation == "FilterColumns"
count(input.action.filterResources) == 1
input.action.filterResources[0].table.columns[i]
is_admin
}
is_admin() {
input.context.identity.user == "admin"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,35 @@ data:
default allow = false
# Allow non-batched access
allow {
is_admin
is_admin
}
# Allow batched access
extended[i] {
some i
input.action.filterResources[i]
is_admin
some i
input.action.filterResources[i]
is_admin
}
# Corner case: filtering columns is done with a single table item, and many columns inside
extended[i] {
some i
input.action.operation == "FilterColumns"
count(input.action.filterResources) == 1
input.action.filterResources[0].table.columns[i]
is_admin
}
# Special rules for bob
allow {
input.action.operation in ["ExecuteQuery", "AccessCatalog"]
is_bob
input.action.operation in ["ExecuteQuery", "AccessCatalog"]
is_bob
}
extended[i] {
input.action.operation in ["FilterCatalogs"]
some i
input.action.filterResources[i]
is_bob
input.action.operation in ["FilterCatalogs"]
some i
input.action.filterResources[i]
is_bob
}
is_admin() {
Expand Down

0 comments on commit f6b6290

Please sign in to comment.