Skip to content

Commit

Permalink
chore(cedar): Add PolicySet.merge
Browse files Browse the repository at this point in the history
  • Loading branch information
dnys1 committed Sep 11, 2024
1 parent 7eab4c8 commit b955c2d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/cedar/lib/src/model/policy_set.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@ abstract class PolicySet
);
}

PolicySet merge(PolicySet? other) {
if (other == null) {
return this;
}
return rebuild((b) {
b.policies.addEntries(other.policies.entries);
b.templates.addEntries(other.templates.entries);
b.templateLinks.addAll(other.templateLinks);
});
}

@override
AuthorizationResponse isAuthorized(AuthorizationRequest request) {
final context = EvaluationContext(
Expand Down

0 comments on commit b955c2d

Please sign in to comment.