Created
July 8, 2021 16:11
-
-
Save adam-sandor/b976e39729f25c3ae82e14a74073949e to your computer and use it in GitHub Desktop.
Rego rule 3 - Only managers from the employee_managers list can create employees
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
employee_managers := {"janedoe@styra.com","alicesmith@styra.com","davidholme@styra.com"} | |
allow { | |
input.attributes.request.http.method == "POST" | |
input.parsed_path[0] = "employees" | |
jwt.valid | |
jwt.payload.Role == "manager" | |
jwt.payload.Group == input.parsed_body.userGroup | |
employee_managers[_] == jwt.payload.sub #is the subject in the employee_managers set? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment