(sec string, ptype string, newRules [][]string, fieldIndex int, fieldValues ...string)
| 521 | } |
| 522 | |
| 523 | func (e *Enforcer) updateFilteredPolicies(sec string, ptype string, newRules [][]string, fieldIndex int, fieldValues ...string) (bool, error) { |
| 524 | oldRules, err := e.updateFilteredPoliciesWithoutNotify(sec, ptype, newRules, fieldIndex, fieldValues...) |
| 525 | ok := len(oldRules) != 0 |
| 526 | if !ok || err != nil { |
| 527 | return ok, err |
| 528 | } |
| 529 | |
| 530 | if e.shouldNotify() { |
| 531 | var err error |
| 532 | if watcher, ok := e.watcher.(persist.UpdatableWatcher); ok { |
| 533 | err = watcher.UpdateForUpdatePolicies(sec, ptype, oldRules, newRules) |
| 534 | } else { |
| 535 | err = e.watcher.Update() |
| 536 | } |
| 537 | return true, err |
| 538 | } |
| 539 | |
| 540 | return true, nil |
| 541 | } |
| 542 | |
| 543 | func (e *Enforcer) GetFieldIndex(ptype string, field string) (int, error) { |
| 544 | return e.model.GetFieldIndex(ptype, field) |
no test coverage detected