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

docs: Add missing OPA rules for Trino batched API #517

Merged
merged 1 commit into from
Jan 2, 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
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
}
fhennig marked this conversation as resolved.
Show resolved Hide resolved

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