Skip to content

Commit

Permalink
fix: decode CasbinRule (#49)
Browse files Browse the repository at this point in the history
When a field does not exist in the mongodb document, CasbinRule uses the last value, expecting the field to be empty
  • Loading branch information
houxul authored Aug 12, 2022
1 parent a1f441b commit 293a343
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ func (a *adapter) LoadFilteredPolicy(model model.Model, filter interface{}) erro
} else {
a.filtered = true
}
line := CasbinRule{}

ctx, cancel := context.WithTimeout(context.TODO(), a.timeout)
defer cancel()
Expand All @@ -238,6 +237,7 @@ func (a *adapter) LoadFilteredPolicy(model model.Model, filter interface{}) erro
}

for cursor.Next(ctx) {
line := CasbinRule{}
err := cursor.Decode(&line)
if err != nil {
return err
Expand Down

0 comments on commit 293a343

Please sign in to comment.