Created
September 20, 2023 12:26
-
-
Save anderseknert/9a095c1b8f95c5afe245102b93d4d10f to your computer and use it in GitHub Desktop.
Logical AND
This file contains 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 policy | |
import future.keywords.if | |
# | |
# valid_email will be assigned the value of the email variable if, and only if, # all the expressions in the body evaluate | |
# | |
valid_email := email if { # rule head, name + (optional) assignment | |
email := lower(input.user.email) # fails if input.user.email is undefined | |
endswith(email, "hooli.com") # fails unless email ends with hooli.com | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment