Skip to content

Commit

Permalink
Bringing up to mainline
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronjeline committed Oct 12, 2023
1 parent 29c09a2 commit a4672ce
Showing 1 changed file with 48 additions and 12 deletions.
60 changes: 48 additions & 12 deletions cedar-policy/src/frontend/is_authorized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -905,9 +905,18 @@ mod test {
#[test]
fn test_authorized_fails_on_policy_collision_with_template() {
let call = r#"{
"principal" : "User::\"alice\"",
"action" : "Photo::\"view\"",
"resource" : "Photo::\"door\"",
"principal" : {
"type" : "User",
"id" : "alice"
},
"action" : {
"type" : "Action",
"id" : "view"
},
"resource" : {
"type" : "Photo",
"id" : "door"
},
"context" : {},
"slice" : {
"policies" : { "ID0": "permit(principal, action, resource);" },
Expand All @@ -926,9 +935,18 @@ mod test {
#[test]
fn test_authorized_fails_on_duplicate_instantiations_ids() {
let call = r#"{
"principal" : "User::\"alice\"",
"action" : "Photo::\"view\"",
"resource" : "Photo::\"door\"",
"principal" : {
"type" : "User",
"id" : "alice"
},
"action" : {
"type" : "Action",
"id" : "view"
},
"resource" : {
"type" : "Photo",
"id" : "door"
},
"context" : {},
"slice" : {
"policies" : {},
Expand Down Expand Up @@ -968,9 +986,18 @@ mod test {
#[test]
fn test_authorized_fails_on_template_instantiation_collision_with_template() {
let call = r#"{
"principal" : "User::\"alice\"",
"action" : "Photo::\"view\"",
"resource" : "Photo::\"door\"",
"principal" : {
"type" : "User",
"id" : "alice"
},
"action" : {
"type" : "Action",
"id" : "view"
},
"resource" : {
"type" : "Photo",
"id" : "door"
},
"context" : {},
"slice" : {
"policies" : {},
Expand Down Expand Up @@ -1000,9 +1027,18 @@ mod test {
#[test]
fn test_authorized_fails_on_template_instantiation_collision_with_policy() {
let call = r#"{
"principal" : "User::\"alice\"",
"action" : "Photo::\"view\"",
"resource" : "Photo::\"door\"",
"principal" : {
"type" : "User",
"id" : "alice"
},
"action" : {
"type" : "Action",
"id" : "view"
},
"resource" : {
"type" : "Photo",
"id" : "door"
},
"context" : {},
"slice" : {
"policies" : { "ID1": "permit(principal, action, resource);" },
Expand Down

0 comments on commit a4672ce

Please sign in to comment.