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

Method initialize

enforcer.go:184–202  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

182}
183
184func (e *Enforcer) initialize() {
185 e.rmMap = map[string]rbac.RoleManager{}
186 e.condRmMap = map[string]rbac.ConditionalRoleManager{}
187 e.eft = effector.NewDefaultEffector()
188 e.watcher = nil
189 e.matcherMap = sync.Map{}
190
191 e.enabled = true
192 e.autoSave = true
193 e.autoBuildRoleLinks = true
194 e.autoNotifyWatcher = true
195 e.autoNotifyDispatcher = true
196 e.initRmMap()
197
198 // Initialize detectors with default detector if not already set
199 if e.detectors == nil {
200 e.detectors = []detector.Detector{detector.NewDefaultDetector()}
201 }
202}
203
204// LoadModel reloads the model from the model CONF file.
205// Because the policy is attached to a model, so the policy is invalidated and needs to be reloaded by calling LoadPolicy().

Callers 3

LoadModelMethod · 0.95
SetModelMethod · 0.95

Calls 3

initRmMapMethod · 0.95
NewDefaultEffectorFunction · 0.92
NewDefaultDetectorFunction · 0.92

Tested by

no test coverage detected