Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Update cedar core to the last version #18

Merged
merged 6 commits into from
Nov 20, 2023
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
81 changes: 48 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ repository = "https://github.com/permitio/cedar-agent"
[dependencies]
async-lock = "2.7.0"
async-trait = "0.1.68"
cedar-policy = "2.0.1"
cedar-policy-core = "2.0.0"
cedar-policy = "2.4.2"
cedar-policy-core = "2.4.2"
clap = { version = "4.2.5", features = ["derive"] }
envy = "0.4.2"
log = "0.4.17"
Expand Down
55 changes: 5 additions & 50 deletions examples/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,15 @@
},
{
"attrs": {},
"parents": [
{
"id": "Admin",
"type": "Role"
}
],
"parents": [],
"uid": {
"id": "delete",
"type": "Action"
}
},
{
"attrs": {},
"parents": [
{
"id": "Admin",
"type": "Role"
}
],
"parents": [],
"uid": {
"id": "create",
"type": "Action"
Expand All @@ -74,58 +64,23 @@
},
{
"attrs": {},
"parents": [
{
"id": "Admin",
"type": "Role"
},
{
"id": "Editor",
"type": "Role"
}
],
"parents": [],
"uid": {
"id": "update",
"type": "Action"
}
},
{
"attrs": {},
"parents": [
{
"id": "Admin",
"type": "Role"
},
{
"id": "Editor",
"type": "Role"
},
{
"id": "Viewer",
"type": "Role"
}
],
"parents": [],
"uid": {
"id": "list",
"type": "Action"
}
},
{
"attrs": {},
"parents": [
{
"id": "Admin",
"type": "Role"
},
{
"id": "Editor",
"type": "Role"
},
{
"id": "Viewer",
"type": "Role"
}
],
"parents": [],
"uid": {
"id": "get",
"type": "Action"
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ extern crate core;
extern crate rocket;

use std::borrow::Borrow;
use std::process::{exit, ExitCode};
use std::process::ExitCode;

use log::{error, info};
use rocket::catchers;
Expand Down
6 changes: 3 additions & 3 deletions src/schemas/data.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::error::Error;

use cedar_policy_core::entities::{
EntitiesError, EntityJSON, EntityJsonParser, NullSchema, TCComputation,
EntitiesError, EntityJSON, EntityJsonParser, NoEntitiesSchema, TCComputation,
};
use cedar_policy_core::extensions::Extensions;
use cedar_policy_core::{ast, entities};
Expand Down Expand Up @@ -31,7 +31,7 @@ impl TryInto<ast::Entity> for Entity {

fn try_into(self) -> Result<ast::Entity, Self::Error> {
debug!("Parsing entity into ast format");
let parser: EntityJsonParser<NullSchema> =
let parser: EntityJsonParser<NoEntitiesSchema> =
EntityJsonParser::new(None, Extensions::all_available(), TCComputation::ComputeNow);
let entities = match parser.from_json_value(self.0) {
Ok(entities) => entities,
Expand Down Expand Up @@ -64,7 +64,7 @@ impl TryInto<entities::Entities> for Entities {

fn try_into(self) -> Result<entities::Entities, Self::Error> {
debug!("Parsing entities into ast format");
let parser: EntityJsonParser<NullSchema> =
let parser: EntityJsonParser<NoEntitiesSchema> =
EntityJsonParser::new(None, Extensions::all_available(), TCComputation::ComputeNow);
parser.from_json_value(json!(self.0))
}
Expand Down
7 changes: 1 addition & 6 deletions tests/services/data_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,7 @@ async fn test_load_entities_from_authz_call() {
},
{
"attrs": {},
"parents": [
{
"id": "Admin",
"type": "Role"
}
],
"parents": [],
"uid": {
"id": "delete",
"type": "Action"
Expand Down
Loading