Skip to content

Commit 92f3c36

Browse files
committed
Revert "Revert "changes""
This reverts commit d83ee15.
1 parent d83ee15 commit 92f3c36

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

cedar-policy-core/src/ast/policy.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -345,15 +345,15 @@ impl Template {
345345
)
346346
.into_validator_generalized_slots_declaration(schema)?;
347347

348-
let values_restricted_expr: HashMap<SlotId, RestrictedExpr> = values
349-
.iter()
350-
.map(|(slot, entity_uid)| (slot.clone(), RestrictedExpr::val(entity_uid.clone())))
351-
.collect();
348+
for (slot, restricted_expr) in values {
349+
// If `?principal` or `?resource` do not have type annotations
350+
// we skip checking them
351+
if (slot.is_principal() || slot.is_resource())
352+
&& (validator_generalized_slots_declaration.get(slot).is_none())
353+
{
354+
continue;
355+
}
352356

353-
for (slot, restricted_expr) in generalized_values
354-
.iter()
355-
.chain(values_restricted_expr.iter())
356-
{
357357
let validator_type = validator_generalized_slots_declaration.get(slot).ok_or(
358358
LinkingError::ArityError {
359359
unbound_values: vec![slot.clone()],

0 commit comments

Comments
 (0)