removePolicies removes rules from the current policy.
(sec string, ptype string, rules [][]string)
| 482 | |
| 483 | // removePolicies removes rules from the current policy. |
| 484 | func (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. |
| 504 | func (e *Enforcer) removeFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues []string) (bool, error) { |
no test coverage detected