Skip to content

Commit f20f259

Browse files
committed
Update OPA example for collection filtering
1 parent 0509f1d commit f20f259

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

examples/opa/docker-compose.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ services:
22
proxy:
33
environment:
44
ITEMS_FILTER_CLS: stac_auth_proxy.filters:Opa
5-
ITEMS_FILTER_ARGS: '["http://opa:8181", "stac/cql2"]'
5+
ITEMS_FILTER_ARGS: '["http://opa:8181", "stac/items_cql2"]'
6+
COLLECTIONS_FILTER_CLS: stac_auth_proxy.filters:Opa
7+
COLLECTIONS_FILTER_ARGS: '["http://opa:8181", "stac/collections_cql2"]'
68

79
opa:
810
image: openpolicyagent/opa:latest
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
package stac
22

3-
default cql2 := "\"naip:year\" = 2021"
3+
default items_cql2 := "\"naip:year\" = 2021"
44

5-
cql2 := "1=1" if {
5+
items_cql2 := "1=1" if {
6+
input.payload.sub != null
7+
}
8+
9+
default collections_cql2 := "id = 'naip'"
10+
11+
collections_cql2 := "1=1" if {
612
input.payload.sub != null
713
}

0 commit comments

Comments
 (0)