Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions policy/assignment/list.rego
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ allow if {
# description: "'reader' in the system scope can list any role assignments."
allow if {
"reader" in input.credentials.roles
input.credentials.system_scope != null
"all" == input.credentials.system_scope
input.credentials.system != null
"all" == input.credentials.system
}

# METADATA
Expand Down
2 changes: 1 addition & 1 deletion policy/assignment/list_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import data.identity.assignment.list

test_allowed if {
list.allow with input as {"credentials": {"roles": ["admin"]}}
list.allow with input as {"credentials": {"roles": ["reader"], "system_scope": "all"}}
list.allow with input as {"credentials": {"roles": ["reader"], "system": "all"}}
list.allow with input as {
"credentials": {"roles": ["admin"], "domain_id": "domain_a"},
"target": {"assignment": {"domain_id": "domain_b"}},
Expand Down
4 changes: 2 additions & 2 deletions policy/auth/project/list.rego
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ allow if {

allow if {
"reader" in input.credentials.roles
input.credentials.system_scope != null
"all" == input.credentials.system_scope
input.credentials.system != null
"all" == input.credentials.system
}
2 changes: 1 addition & 1 deletion policy/auth/project/list_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import data.identity.auth.project.list

test_allowed if {
list.allow with input as {"credentials": {"roles": ["admin"]}}
list.allow with input as {"credentials": {"roles": ["reader"], "system_scope": "all"}}
list.allow with input as {"credentials": {"roles": ["reader"], "system": "all"}}
list.allow with input as {"credentials": {"roles": []}}
list.allow with input as {"credentials": {"roles": ["reader"]}}
}
4 changes: 2 additions & 2 deletions policy/auth/token/show.rego
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ allow if {
# description: "'reader' in the system scope can inspect tokens"
allow if {
"reader" in input.credentials.roles
input.credentials.system_scope != null
"all" == input.credentials.system_scope
input.credentials.system != null
"all" == input.credentials.system
}

# METADATA
Expand Down
4 changes: 2 additions & 2 deletions policy/auth/token/show_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import data.identity.auth.token.show
test_allowed if {
show.allow with input as {"credentials": {"roles": ["admin"]}}
show.allow with input as {"credentials": {"roles": ["service"]}}
show.allow with input as {"credentials": {"roles": ["reader"], "system_scope": "all"}}
show.allow with input as {"credentials": {"roles": ["reader"], "system": "all"}}
show.allow with input as {"credentials": {"user_id": "foo"}, "existing": {"token": {"user": {"id": "foo"}}}}
show.allow with input as {"credentials": {"roles": ["admin"], "user_id": "foo"}, "existing": {"token": {"user": {"id": "bar"}}}}
}

test_forbidden if {
not show.allow with input as {"credentials": {"roles": ["reader"], "system_scope": "not_all"}}
not show.allow with input as {"credentials": {"roles": ["reader"], "system": "not_all"}}
not show.allow with input as {"credentials": {"roles": ["manager"], "user_id": "foo"}, "existing": {"token": {"user": {"id": "bar"}}}}
not show.allow with input as {"credentials": {"roles": ["member"], "user_id": "foo"}, "existing": {"token": {"user": {"id": "bar"}}}}
not show.allow with input as {"credentials": {"roles": ["reader"], "user_id": "foo"}, "existing": {"token": {"user": {"id": "bar"}}}}
Expand Down
4 changes: 2 additions & 2 deletions policy/endpoint/list.rego
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ allow if {
# description: "'reader' in the system scope can list any endpoints."
allow if {
"reader" in input.credentials.roles
input.credentials.system_scope != null
"all" == input.credentials.system_scope
input.credentials.system != null
"all" == input.credentials.system
}
4 changes: 2 additions & 2 deletions policy/endpoint/list_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import data.identity.endpoint.list
test_allowed if {
list.allow with input as {"credentials": {"roles": ["admin"]}}
list.allow with input as {"credentials": {"is_admin": true}}
list.allow with input as {"credentials": {"roles": ["reader"], "system_scope": "all"}}
list.allow with input as {"credentials": {"roles": ["reader"], "system": "all"}}
}

test_forbidden if {
not list.allow with input as {"credentials": {"roles": []}}
not list.allow with input as {"credentials": {"roles": ["reader"]}}
not list.allow with input as {"credentials": {"roles": ["reader"], "system_scope": "domain"}}
not list.allow with input as {"credentials": {"roles": ["reader"], "system": "domain"}}
not list.allow with input as {"credentials": {"roles": ["manager"]}}
}
4 changes: 2 additions & 2 deletions policy/endpoint/show.rego
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ allow if {
# description: "'reader' in the system scope can show any endpoint."
allow if {
"reader" in input.credentials.roles
input.credentials.system_scope != null
"all" == input.credentials.system_scope
input.credentials.system != null
"all" == input.credentials.system
}
4 changes: 2 additions & 2 deletions policy/endpoint/show_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import data.identity.endpoint.show
test_allowed if {
show.allow with input as {"credentials": {"roles": ["admin"]}}
show.allow with input as {"credentials": {"is_admin": true}}
show.allow with input as {"credentials": {"roles": ["reader"], "system_scope": "all"}}
show.allow with input as {"credentials": {"roles": ["reader"], "system": "all"}}
}

test_forbidden if {
not show.allow with input as {"credentials": {"roles": []}}
not show.allow with input as {"credentials": {"roles": ["reader"]}}
not show.allow with input as {"credentials": {"roles": ["reader"], "system_scope": "domain"}}
not show.allow with input as {"credentials": {"roles": ["reader"], "system": "domain"}}
not show.allow with input as {"credentials": {"roles": ["manager"]}}
}
4 changes: 2 additions & 2 deletions policy/service/list.rego
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ allow if {
# description: "'reader' in the system scope can list any services."
allow if {
"reader" in input.credentials.roles
input.credentials.system_scope != null
"all" == input.credentials.system_scope
input.credentials.system != null
"all" == input.credentials.system
}
4 changes: 2 additions & 2 deletions policy/service/list_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import data.identity.service.list
test_allowed if {
list.allow with input as {"credentials": {"roles": ["admin"]}}
list.allow with input as {"credentials": {"is_admin": true}}
list.allow with input as {"credentials": {"roles": ["reader"], "system_scope": "all"}}
list.allow with input as {"credentials": {"roles": ["reader"], "system": "all"}}
}

test_forbidden if {
not list.allow with input as {"credentials": {"roles": []}}
not list.allow with input as {"credentials": {"roles": ["reader"]}}
not list.allow with input as {"credentials": {"roles": ["reader"], "system_scope": "domain"}}
not list.allow with input as {"credentials": {"roles": ["reader"], "system": "domain"}}
not list.allow with input as {"credentials": {"roles": ["manager"]}}
}
4 changes: 2 additions & 2 deletions policy/service/show.rego
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ allow if {
# description: "'reader' in the system scope can show any service."
allow if {
"reader" in input.credentials.roles
input.credentials.system_scope != null
"all" == input.credentials.system_scope
input.credentials.system != null
"all" == input.credentials.system
}
4 changes: 2 additions & 2 deletions policy/service/show_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import data.identity.service.show
test_allowed if {
show.allow with input as {"credentials": {"roles": ["admin"]}}
show.allow with input as {"credentials": {"is_admin": true}}
show.allow with input as {"credentials": {"roles": ["reader"], "system_scope": "all"}}
show.allow with input as {"credentials": {"roles": ["reader"], "system": "all"}}
}

test_forbidden if {
not show.allow with input as {"credentials": {"roles": []}}
not show.allow with input as {"credentials": {"roles": ["reader"]}}
not show.allow with input as {"credentials": {"roles": ["reader"], "system_scope": "domain"}}
not show.allow with input as {"credentials": {"roles": ["reader"], "system": "domain"}}
not show.allow with input as {"credentials": {"roles": ["manager"]}}
}
Loading