Sty -OPA - Rego : Basic Rego Rules

 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 Boolean Rules & Evaluation

OPA Policy Authorization : Through out we will be using API policy evaluation . This is very simple use case and a common use case. 


Boolean Rules :

Remember that every rule is an IF statement . When you are going to write an IF statement you are going to assign a value .





Multiple Rules :

In all of those rules we were thinking of them in Isolation . But with OPA you can goahead and write multiple rule and if you do that you will end up with writing a logical OR.


Even though you can write multiple .



What happens when non of the Rules Succeed. Then the value of that rule is undefined.

But in some cases you do not want the default "undefined" result and - if non of the rules succeed.

  • default is_read = false

This is achieved by defining the result as - false

This says that non of the value succeed that we know the value it "False"


We have to make these rules mutually exclusive. 




Comments

Popular posts from this blog

Sty -OPA - Rego : What is OPA

Sty -OPA - Rego : Comparing and Constructing Values