Skip to content

Commit

Permalink
Merge pull request #890 from linzworld/patch-1
Browse files Browse the repository at this point in the history
fix: Set the correct value for logExplains
  • Loading branch information
hsluoyz committed Sep 18, 2021
2 parents 9253c81 + 94db050 commit 8987b14
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions enforcer.go
Expand Up @@ -664,10 +664,13 @@ func (e *Enforcer) enforce(matcher string, explains *[]string, rvals ...interfac
var logExplains [][]string

if explains != nil {
logExplains = append(logExplains, *explains)

if len(*explains) > 0 {
logExplains = append(logExplains, *explains)
}

if explainIndex != -1 && len(e.model["p"][pType].Policy) > explainIndex {
*explains = e.model["p"][pType].Policy[explainIndex]
logExplains = append(logExplains, *explains)
}
}

Expand Down

0 comments on commit 8987b14

Please sign in to comment.