Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
11 changes: 10 additions & 1 deletion cedar-policy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.2.0] - upcoming

### Added

- New `ffi` module with an improved FFI interface. This will replace the
`frontend` module in the 4.0 release, but is available now for early adopters;
the `frontend` module is now deprecated.

## [3.1.3] - 2024-04-15

### Changed
Expand Down Expand Up @@ -423,7 +431,8 @@ Cedar Language Version: 2.0.0
Cedar Language Version: 2.0.0
- Initial release of `cedar-policy`.

[Unreleased]: https://github.com/cedar-policy/cedar/compare/v3.1.3...main
[Unreleased]: https://github.com/cedar-policy/cedar/compare/v3.2.0...main
[3.2.0]: https://github.com/cedar-policy/cedar/compare/v3.1.3...v3.2.0
[3.1.3]: https://github.com/cedar-policy/cedar/compare/v3.1.2...v3.1.3
[3.1.2]: https://github.com/cedar-policy/cedar/compare/v3.1.1...v3.1.2
[3.1.1]: https://github.com/cedar-policy/cedar/compare/v3.1.0...v3.1.1
Expand Down
26 changes: 24 additions & 2 deletions cedar-policy/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -844,9 +844,9 @@ impl From<authorizer::AuthorizationError> for AuthorizationError {
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct Response {
/// Authorization decision
decision: Decision,
pub(crate) decision: Decision,
/// Diagnostics providing more information on how this decision was reached
diagnostics: Diagnostics,
pub(crate) diagnostics: Diagnostics,
}

/// A partially evaluated authorization response.
Expand Down Expand Up @@ -1109,6 +1109,16 @@ impl Diagnostics {
pub fn errors(&self) -> impl Iterator<Item = &AuthorizationError> + '_ {
self.errors.iter()
}

/// Consume the `Diagnostics`, producing owned versions of `reason()` and `errors()`
pub(crate) fn into_components(
self,
) -> (
impl Iterator<Item = PolicyId>,
impl Iterator<Item = AuthorizationError>,
) {
(self.reason.into_iter(), self.errors.into_iter())
}
}

impl Response {
Expand Down Expand Up @@ -1711,6 +1721,18 @@ impl<'a> ValidationResult<'a> {
.map(|w| w as &dyn Diagnostic)
})
}

pub(crate) fn into_errors_and_warnings(
self,
) -> (
impl Iterator<Item = ValidationError<'static>>,
impl Iterator<Item = ValidationWarning<'static>>,
) {
(
self.validation_errors.into_iter(),
self.validation_warnings.into_iter(),
)
}
}

impl<'a> From<cedar_policy_validator::ValidationResult<'a>> for ValidationResult<'static> {
Expand Down
Loading