Skip to content

Commit

Permalink
Update to RFC 55 (#161)
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Eline <[email protected]>
  • Loading branch information
aaronjeline authored Jun 19, 2024
1 parent 327cbaa commit 7bd0362
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions cedar-rust-hello-world/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 = "
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions tinytodo/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
)
Expand Down

0 comments on commit 7bd0362

Please sign in to comment.