Skip to content

Commit

Permalink
Prep for v2.5.0 release (#1189)
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Vicente Garcia Orozco <juano@amazon.com>
Co-authored-by: Juan V. García <111006213+jv-garcia@users.noreply.github.com>
Co-authored-by: Juan Vicente Garcia Orozco <juano@amazon.com>
  • Loading branch information
3 people authored Sep 11, 2024
1 parent c16d4e3 commit 8daee36
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 13 deletions.
6 changes: 3 additions & 3 deletions cedar-policy-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "cedar-policy-cli"
edition = "2021"

version = "2.4.7"
version = "2.5.0"
license = "Apache-2.0"
categories = ["compilers", "config"]
description = "CLI interface for the Cedar Policy language."
Expand All @@ -11,8 +11,8 @@ homepage = "https://cedarpolicy.com"
repository = "https://github.com/cedar-policy/cedar"

[dependencies]
cedar-policy = { version = "=2.4.7", path = "../cedar-policy" }
cedar-policy-formatter = { version = "=2.4.7", path = "../cedar-policy-formatter" }
cedar-policy = { version = "=2.5.0", path = "../cedar-policy" }
cedar-policy-formatter = { version = "=2.5.0", path = "../cedar-policy-formatter" }
clap = { version = "4", features = ["derive", "env"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion cedar-policy-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "cedar-policy-core"
edition = "2021"
build = "build.rs"

version = "2.4.7"
version = "2.5.0"
license = "Apache-2.0"
categories = ["compilers", "config"]
description = "Core implemenation of the Cedar Policy language."
Expand Down
4 changes: 2 additions & 2 deletions cedar-policy-formatter/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cedar-policy-formatter"
version = "2.4.7"
version = "2.5.0"
edition = "2021"
license = "Apache-2.0"
categories = ["compilers", "config"]
Expand All @@ -10,7 +10,7 @@ homepage = "https://cedarpolicy.com"
repository = "https://github.com/cedar-policy/cedar"

[dependencies]
cedar-policy-core = { version = "=2.4.7", path = "../cedar-policy-core" }
cedar-policy-core = { version = "=2.5.0", path = "../cedar-policy-core" }
pretty = "0.12.1"
logos = "0.13.0"
itertools = "0.10"
Expand Down
4 changes: 2 additions & 2 deletions cedar-policy-validator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "cedar-policy-validator"
edition = "2021"

version = "2.4.7"
version = "2.5.0"
license = "Apache-2.0"
categories = ["compilers", "config"]
description = "Validator for the Cedar Policy language."
Expand All @@ -11,7 +11,7 @@ homepage = "https://cedarpolicy.com"
repository = "https://github.com/cedar-policy/cedar"

[dependencies]
cedar-policy-core = { version = "=2.4.7", path = "../cedar-policy-core" }
cedar-policy-core = { version = "=2.5.0", path = "../cedar-policy-core" }
serde = { version = "=1.0.193", features = ["derive"] }
serde_json = { version = "=1.0.108", features = ["preserve_order"] }
serde_with = "=3.4.0"
Expand Down
6 changes: 3 additions & 3 deletions cedar-policy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "cedar-policy"
edition = "2021"

version = "2.4.7"
version = "2.5.0"
license = "Apache-2.0"
categories = ["compilers", "config"]
description = "Cedar is a language for defining permissions as policies, which describe who should have access to what."
Expand All @@ -11,8 +11,8 @@ homepage = "https://cedarpolicy.com"
repository = "https://github.com/cedar-policy/cedar"

[dependencies]
cedar-policy-core = { version = "=2.4.7", path = "../cedar-policy-core" }
cedar-policy-validator = { version = "=2.4.7", path = "../cedar-policy-validator" }
cedar-policy-core = { version = "=2.5.0", path = "../cedar-policy-core" }
cedar-policy-validator = { version = "=2.5.0", path = "../cedar-policy-validator" }
ref-cast = "1.0"
serde = { version = "1.0", features = ["derive", "rc"] }
serde_json = "1.0"
Expand Down
16 changes: 14 additions & 2 deletions cedar-policy/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,18 @@ impl PolicySet {
self.ast.is_empty()
}

/// Returns the number of `Policy`s in the `PolicySet`.
///
/// This will include both static and template-linked policies.
pub fn num_of_policies(&self) -> usize {
self.policies.len()
}

/// Returns the number of `Template`s in the `PolicySet`.
pub fn num_of_templates(&self) -> usize {
self.templates.len()
}

/// Attempt to link a template and add the new template-linked policy to the policy set.
/// If link fails, the `PolicySet` is not modified.
/// Failure can happen for three reasons
Expand Down Expand Up @@ -3605,8 +3617,8 @@ mod policy_set_tests {
)
.expect("Link failure");

assert_eq!(pset.templates().count(), 1);
assert_eq!(pset.policies().count(), 2);
assert_eq!(pset.num_of_templates(), 1);
assert_eq!(pset.num_of_policies(), 2);
assert_eq!(pset.policies().filter(|p| p.is_static()).count(), 1);

assert_eq!(
Expand Down

0 comments on commit 8daee36

Please sign in to comment.