Skip to content

Commit 95e8c3b

Browse files
authored
Update enforcer.go
1 parent e2bab52 commit 95e8c3b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

enforcer.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -683,23 +683,23 @@ func (e *Enforcer) invalidateMatcherMap() {
683683
// checkAIPolicies evaluates AI policies and returns true if any policy allows the request.
684684
func (e *Enforcer) checkAIPolicies(rvals []interface{}) (bool, error) {
685685
aType := "a"
686-
686+
687687
// Check if AI policies exist
688688
if _, ok := e.model["a"]; !ok {
689689
return false, nil
690690
}
691-
691+
692692
aPolicies, ok := e.model["a"][aType]
693693
if !ok || len(aPolicies.Policy) == 0 {
694694
return false, nil
695695
}
696-
696+
697697
// Evaluate AI policies
698698
for _, aPolicy := range aPolicies.Policy {
699699
if len(aPolicy) == 0 {
700700
continue
701701
}
702-
702+
703703
// The AI policy description is the first (and typically only) field
704704
policyDescription := aPolicy[0]
705705
allowed, err := e.evaluateAIPolicy(policyDescription, rvals)
@@ -708,12 +708,12 @@ func (e *Enforcer) checkAIPolicies(rvals []interface{}) (bool, error) {
708708
e.logAIPolicyError(err)
709709
continue
710710
}
711-
711+
712712
if allowed {
713713
return true, nil
714714
}
715715
}
716-
716+
717717
return false, nil
718718
}
719719

@@ -722,7 +722,7 @@ func (e *Enforcer) logAIPolicyError(err error) {
722722
if e.logger == nil {
723723
return
724724
}
725-
725+
726726
logEntry := &log.LogEntry{
727727
EventType: "ai_policy_evaluation_error",
728728
Error: err,

0 commit comments

Comments
 (0)