Skip to content

Commit

Permalink
fix: attrs setup
Browse files Browse the repository at this point in the history
  • Loading branch information
davenewza committed Feb 18, 2025
1 parent 94b3450 commit 96a159a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 0 additions & 2 deletions schema/attributes/computed.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ func defaultComputed(schema []*parser.AST) (*expressions.Parser, error) {
}

opts := []expressions.Option{
options.WithCtx(),
options.WithSchemaTypes(schema),
options.WithComparisonOperators(),
options.WithLogicalOperators(),
options.WithArithmeticOperators(),
options.WithFunctions(),
options.WithReturnTypeAssertion(parser.FieldTypeBoolean, false),
}

parser, err := expressions.NewParser(opts...)
Expand Down
10 changes: 4 additions & 6 deletions schema/attributes/permission.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,15 @@ func ValidatePermissionExpression(schema []*parser.AST, model *parser.ModelNode,

opts := []expressions.Option{}

operands, err := resolve.IdentOperands(expression)
if err != nil {
return nil, err
}
operands, _ := resolve.IdentOperands(expression)

if action != nil {
if action != nil && operands != nil {
out:
for _, operand := range operands {
for _, input := range action.Inputs {
if operand.Fragments[0] == input.Name() {
opts = append(opts, options.WithActionInputs(schema, action))
break
break out
}
}
}
Expand Down

0 comments on commit 96a159a

Please sign in to comment.