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

Method removePolicies

internal_api.go:484–501  ·  view source on GitHub ↗

removePolicies removes rules from the current policy.

(sec string, ptype string, rules [][]string)

Source from the content-addressed store, hash-verified

482
483// removePolicies removes rules from the current policy.
484func (e *Enforcer) removePolicies(sec string, ptype string, rules [][]string) (bool, error) {
485 ok, err := e.removePoliciesWithoutNotify(sec, ptype, rules)
486 if !ok || err != nil {
487 return ok, err
488 }
489
490 if e.shouldNotify() {
491 var err error
492 if watcher, ok := e.watcher.(persist.WatcherEx); ok {
493 err = watcher.UpdateForRemovePolicies(sec, ptype, rules...)
494 } else {
495 err = e.watcher.Update()
496 }
497 return true, err
498 }
499
500 return true, nil
501}
502
503// removeFilteredPolicy removes rules based on field filters from the current policy.
504func (e *Enforcer) removeFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues []string) (bool, error) {

Callers 2

RemoveNamedPoliciesMethod · 0.95

Calls 4

shouldNotifyMethod · 0.95
UpdateMethod · 0.65

Tested by

no test coverage detected