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

Method ClearPolicy

enforcer.go:352–360  ·  view source on GitHub ↗

ClearPolicy clears all policy.

()

Source from the content-addressed store, hash-verified

350
351// ClearPolicy clears all policy.
352func (e *Enforcer) ClearPolicy() {
353 e.invalidateMatcherMap()
354
355 if e.dispatcher != nil && e.autoNotifyDispatcher {
356 _ = e.dispatcher.ClearPolicy()
357 return
358 }
359 e.model.ClearPolicy()
360}
361
362// LoadPolicy reloads the policy from file/database.
363func (e *Enforcer) LoadPolicy() error {

Callers 6

TestClearPolicyFunction · 0.95
TestModifyPolicyAPIFunction · 0.95
TestImplicitUserAPIFunction · 0.95

Calls 2

invalidateMatcherMapMethod · 0.95
ClearPolicyMethod · 0.65

Tested by 6

TestClearPolicyFunction · 0.76
TestModifyPolicyAPIFunction · 0.76
TestImplicitUserAPIFunction · 0.76