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

Update to RFC 55 #161

Merged
merged 2 commits into from
Jun 19, 2024
Merged
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
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
Loading