MCPcopy
hub / github.com/apache/casbin / updatePolicies

Method updatePolicies

internal_api.go:464–481  ·  view source on GitHub ↗
(sec string, ptype string, oldRules [][]string, newRules [][]string)

Source from the content-addressed store, hash-verified

462}
463
464func (e *Enforcer) updatePolicies(sec string, ptype string, oldRules [][]string, newRules [][]string) (bool, error) {
465 ok, err := e.updatePoliciesWithoutNotify(sec, ptype, oldRules, newRules)
466 if !ok || err != nil {
467 return ok, err
468 }
469
470 if e.shouldNotify() {
471 var err error
472 if watcher, ok := e.watcher.(persist.UpdatableWatcher); ok {
473 err = watcher.UpdateForUpdatePolicies(sec, ptype, oldRules, newRules)
474 } else {
475 err = e.watcher.Update()
476 }
477 return true, err
478 }
479
480 return true, nil
481}
482
483// removePolicies removes rules from the current policy.
484func (e *Enforcer) removePolicies(sec string, ptype string, rules [][]string) (bool, error) {

Callers 2

UpdateNamedPoliciesMethod · 0.95

Calls 4

shouldNotifyMethod · 0.95
UpdateMethod · 0.65

Tested by

no test coverage detected