File tree Expand file tree Collapse file tree 6 files changed +25
-13
lines changed
Expand file tree Collapse file tree 6 files changed +25
-13
lines changed Original file line number Diff line number Diff line change 22name = " cedar-policy-cli"
33edition = " 2021"
44
5- version = " 2.4.7 "
5+ version = " 2.5.0 "
66license = " Apache-2.0"
77categories = [" compilers" , " config" ]
88description = " CLI interface for the Cedar Policy language."
@@ -11,8 +11,8 @@ homepage = "https://cedarpolicy.com"
1111repository = " https://github.com/cedar-policy/cedar"
1212
1313[dependencies ]
14- cedar-policy = { version = " =2.4.7 " , path = " ../cedar-policy" }
15- cedar-policy-formatter = { version = " =2.4.7 " , path = " ../cedar-policy-formatter" }
14+ cedar-policy = { version = " =2.5.0 " , path = " ../cedar-policy" }
15+ cedar-policy-formatter = { version = " =2.5.0 " , path = " ../cedar-policy-formatter" }
1616clap = { version = " 4" , features = [" derive" , " env" ] }
1717serde = { version = " 1.0" , features = [" derive" ] }
1818serde_json = " 1.0"
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ name = "cedar-policy-core"
33edition = " 2021"
44build = " build.rs"
55
6- version = " 2.4.7 "
6+ version = " 2.5.0 "
77license = " Apache-2.0"
88categories = [" compilers" , " config" ]
99description = " Core implemenation of the Cedar Policy language."
Original file line number Diff line number Diff line change 11[package ]
22name = " cedar-policy-formatter"
3- version = " 2.4.7 "
3+ version = " 2.5.0 "
44edition = " 2021"
55license = " Apache-2.0"
66categories = [" compilers" , " config" ]
@@ -10,7 +10,7 @@ homepage = "https://cedarpolicy.com"
1010repository = " https://github.com/cedar-policy/cedar"
1111
1212[dependencies ]
13- cedar-policy-core = { version = " =2.4.7 " , path = " ../cedar-policy-core" }
13+ cedar-policy-core = { version = " =2.5.0 " , path = " ../cedar-policy-core" }
1414pretty = " 0.12.1"
1515logos = " 0.13.0"
1616itertools = " 0.10"
Original file line number Diff line number Diff line change 22name = " cedar-policy-validator"
33edition = " 2021"
44
5- version = " 2.4.7 "
5+ version = " 2.5.0 "
66license = " Apache-2.0"
77categories = [" compilers" , " config" ]
88description = " Validator for the Cedar Policy language."
@@ -11,7 +11,7 @@ homepage = "https://cedarpolicy.com"
1111repository = " https://github.com/cedar-policy/cedar"
1212
1313[dependencies ]
14- cedar-policy-core = { version = " =2.4.7 " , path = " ../cedar-policy-core" }
14+ cedar-policy-core = { version = " =2.5.0 " , path = " ../cedar-policy-core" }
1515serde = { version = " =1.0.193" , features = [" derive" ] }
1616serde_json = { version = " =1.0.108" , features = [" preserve_order" ] }
1717serde_with = " =3.4.0"
Original file line number Diff line number Diff line change 22name = " cedar-policy"
33edition = " 2021"
44
5- version = " 2.4.7 "
5+ version = " 2.5.0 "
66license = " Apache-2.0"
77categories = [" compilers" , " config" ]
88description = " Cedar is a language for defining permissions as policies, which describe who should have access to what."
@@ -11,8 +11,8 @@ homepage = "https://cedarpolicy.com"
1111repository = " https://github.com/cedar-policy/cedar"
1212
1313[dependencies ]
14- cedar-policy-core = { version = " =2.4.7 " , path = " ../cedar-policy-core" }
15- cedar-policy-validator = { version = " =2.4.7 " , path = " ../cedar-policy-validator" }
14+ cedar-policy-core = { version = " =2.5.0 " , path = " ../cedar-policy-core" }
15+ cedar-policy-validator = { version = " =2.5.0 " , path = " ../cedar-policy-validator" }
1616ref-cast = " 1.0"
1717serde = { version = " 1.0" , features = [" derive" , " rc" ] }
1818serde_json = " 1.0"
Original file line number Diff line number Diff line change @@ -1639,6 +1639,18 @@ impl PolicySet {
16391639 self . ast . is_empty ( )
16401640 }
16411641
1642+ /// Returns the number of `Policy`s in the `PolicySet`.
1643+ ///
1644+ /// This will include both static and template-linked policies.
1645+ pub fn num_of_policies ( & self ) -> usize {
1646+ self . policies . len ( )
1647+ }
1648+
1649+ /// Returns the number of `Template`s in the `PolicySet`.
1650+ pub fn num_of_templates ( & self ) -> usize {
1651+ self . templates . len ( )
1652+ }
1653+
16421654 /// Attempt to link a template and add the new template-linked policy to the policy set.
16431655 /// If link fails, the `PolicySet` is not modified.
16441656 /// Failure can happen for three reasons
@@ -3605,8 +3617,8 @@ mod policy_set_tests {
36053617 )
36063618 . expect ( "Link failure" ) ;
36073619
3608- assert_eq ! ( pset. templates ( ) . count ( ) , 1 ) ;
3609- assert_eq ! ( pset. policies ( ) . count ( ) , 2 ) ;
3620+ assert_eq ! ( pset. num_of_templates ( ) , 1 ) ;
3621+ assert_eq ! ( pset. num_of_policies ( ) , 2 ) ;
36103622 assert_eq ! ( pset. policies( ) . filter( |p| p. is_static( ) ) . count( ) , 1 ) ;
36113623
36123624 assert_eq ! (
You can’t perform that action at this time.
0 commit comments