MCPcopy Index your code
hub / github.com/apache/casbin / updateFilteredPolicies

Method updateFilteredPolicies

internal_api.go:523–541  ·  view source on GitHub ↗
(sec string, ptype string, newRules [][]string, fieldIndex int, fieldValues ...string)

Source from the content-addressed store, hash-verified

521}
522
523func (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
543func (e *Enforcer) GetFieldIndex(ptype string, field string) (int, error) {
544 return e.model.GetFieldIndex(ptype, field)

Callers 1

Calls 4

shouldNotifyMethod · 0.95
UpdateMethod · 0.65

Tested by

no test coverage detected