Skip to content

Commit

Permalink
Renames http_api -> input as in tutorial
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Dursi <jonathan@dursi.ca>
  • Loading branch information
ljdursi authored and tsandall committed Aug 16, 2019
1 parent 06cab01 commit f9e71d7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions api_authz/docker/policy/api_authz.rego
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package httpapi.authz
subordinates = {"alice": [], "charlie": [], "bob": ["alice"], "betty": ["charlie"]}

# HTTP API request
import input as http_api
# http_api = {
import input
# input = {
# "path": ["finance", "salary", "alice"],
# "user": "alice",
# "method": "GET"
Expand All @@ -14,14 +14,14 @@ default allow = false

# Allow users to get their own salaries.
allow {
http_api.method = "GET"
http_api.path = ["finance", "salary", username]
username = http_api.user
input.method = "GET"
input.path = ["finance", "salary", username]
input.user == username
}

# Allow managers to get their subordinates' salaries.
allow {
http_api.method = "GET"
http_api.path = ["finance", "salary", username]
subordinates[http_api.user][_] = username
input.method = "GET"
input.path = ["finance", "salary", username]
subordinates[input.user][_] == username
}

0 comments on commit f9e71d7

Please sign in to comment.