From 7bd03623c36e6048902da56de33a84dc091844d8 Mon Sep 17 00:00:00 2001 From: Aaron Eline Date: Wed, 19 Jun 2024 13:57:44 -0400 Subject: [PATCH] Update to RFC 55 (#161) Signed-off-by: Aaron Eline --- cedar-rust-hello-world/src/main.rs | 8 ++++---- tinytodo/src/context.rs | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cedar-rust-hello-world/src/main.rs b/cedar-rust-hello-world/src/main.rs index acc3be8..95d28fc 100644 --- a/cedar-rust-hello-world/src/main.rs +++ b/cedar-rust-hello-world/src/main.rs @@ -101,7 +101,7 @@ fn json_context() { let (p, a, r) = create_p_a_r(); // create a request - let request: Request = Request::new(Some(p), Some(a), Some(r), c, None).unwrap(); + let request: Request = Request::new(p, a, r, c, None).unwrap(); // create a policy let s = r#"permit( @@ -145,7 +145,7 @@ fn entity_json() { ); let c = Context::from_pairs(context2).expect("no duplicate keys!"); - let request: Request = Request::new(Some(p), Some(a), Some(r), c, None).unwrap(); + let request: Request = Request::new(p, a, r, c, None).unwrap(); // create a policy let s = " @@ -189,7 +189,7 @@ fn entity_objects() { ); let c = Context::empty(); - let request: Request = Request::new(Some(p), Some(a), Some(r), c, None).unwrap(); + let request: Request = Request::new(p, a, r, c, None).unwrap(); // create a policy let c1 = "permit( @@ -419,7 +419,7 @@ fn annotate() { let policies = PolicySet::from_str(src).unwrap(); let (p, a, r) = create_p_a_r(); - let request: Request = Request::new(Some(p), Some(a), Some(r), Context::empty(), None).unwrap(); + let request: Request = Request::new(p, a, r, Context::empty(), None).unwrap(); let ans = execute_query(&request, &policies, Entities::empty()); for reason in ans.diagnostics().reason() { //print all the annotations diff --git a/tinytodo/src/context.rs b/tinytodo/src/context.rs index df1a651..5ebcb10 100644 --- a/tinytodo/src/context.rs +++ b/tinytodo/src/context.rs @@ -513,10 +513,10 @@ impl AppContext { self.is_authorized(&r.uid, &*ACTION_GET_LISTS, &*APPLICATION_TINY_TODO)?; let entities: Entities = self.entities.as_entities(&self.schema); let partial_request = RequestBuilder::default() - .action(Some(ACTION_GET_LIST.as_ref().clone().into())) - .principal(Some(cedar_policy::EntityUid::from(EntityUid::from( + .action(ACTION_GET_LIST.as_ref().clone().into()) + .principal(cedar_policy::EntityUid::from(EntityUid::from( r.uid.clone(), - )))) + ))) .build(); let partial_response = self.authorizer @@ -582,9 +582,9 @@ impl AppContext { ) -> Result<()> { let es = self.entities.as_entities(&self.schema); let q = Request::new( - Some(principal.as_ref().clone().into()), - Some(action.as_ref().clone().into()), - Some(resource.as_ref().clone().into()), + principal.as_ref().clone().into(), + action.as_ref().clone().into(), + resource.as_ref().clone().into(), Context::empty(), Some(&self.schema), )