Created
September 20, 2023 12:46
-
-
Save anderseknert/019f62be3cd9bf82d09fda1ac4b82b5e to your computer and use it in GitHub Desktop.
Helper functions
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 | |
default allow := false | |
allow if { | |
idx := indexof(input.user.email, "@") | |
fullname := substring(input.user.email, 0, idx) | |
firstname := lower(split(fullname, ".")[0]) | |
allowed_firstname(firstname) | |
} | |
# First name may be either "joe" or "jane" for function to evaluate | |
allowed_firstname(name) if name == "joe" | |
allowed_firstname(name) if name == "jane" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment