Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve docs on else keyword #475

Closed
tsandall opened this issue Oct 10, 2017 · 0 comments
Closed

Improve docs on else keyword #475

tsandall opened this issue Oct 10, 2017 · 0 comments
Labels

Comments

@tsandall
Copy link
Member

The docs currently show this example for the else keyword:

# Service queries "authorize" and intreprets result ("allow" or "deny")
authorize = "allow" {
    input.user = "superuser"
}

# Check if caller is from outside network.
else = "deny" {
    input.path[0] = "admin"
    input.source_network = "external"
}

# Check if caller is from inside network.
else = "allow" {
    input.path[0] = "admin"
    input.source_network = "internal"
} # ... more rules

From this example, it's not obvious that else is applied to the rule above (i.e., authorize).

# Service queries "authorize" and intreprets result ("allow" or "deny")
authorize = "allow" {
    input.user = "superuser"
} else = "deny" { 
    # Check if caller is from outside network.
    input.path[0] = "admin"
    input.source_network = "external"
} else = "allow" {
    # Check if caller is from inside network.
    input.path[0] = "admin"
    input.source_network = "internal"
} # ... more rules

We should replace the example with the second snippet above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant