-
-
Save tsandall/fd292e5bd16a23fcde6f1c49b20ca85a to your computer and use it in GitHub Desktop.
Examples for Partial Evaluation post on blog.openpolicyagent.org
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| allow { | |
| risk_score = (input.num_deletes * 10) + input.num_adds | |
| risk_score < risk_limit[input.user.title] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package smart_home.authz | |
| default allow = false | |
| allow = true { | |
| op = allowed_operations[_] | |
| input.method = op.method | |
| input.resource = op.resource | |
| } | |
| allowed_operations = [ | |
| {“method”: “PUT”, “resource”: “air-conditioner”}, | |
| {“method”: “GET”, “resource”: “security-camera”}, | |
| {“method”: “POST”, “resource”: “garage-door”}, | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| default allow = false | |
| allow { | |
| input.method = “PUT” | |
| input.resource = “air-conditioner” | |
| } | |
| allow { | |
| input.method = “GET” | |
| input.resource = “security-camera” | |
| } | |
| allow { | |
| input.method = “POST” | |
| input.resource = “garage-door” | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment