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

Method AddPolicy

management_api.go:236–238  ·  view source on GitHub ↗

AddPolicy adds an authorization rule to the current policy. If the rule already exists, the function returns false and the rule will not be added. Otherwise the function returns true by adding the new rule.

(params ...interface{})

Source from the content-addressed store, hash-verified

234// If the rule already exists, the function returns false and the rule will not be added.
235// Otherwise the function returns true by adding the new rule.
236func (e *Enforcer) AddPolicy(params ...interface{}) (bool, error) {
237 return e.AddNamedPolicy("p", params...)
238}
239
240// AddPolicies adds authorization rules to the current policy.
241// If the rule already exists, the function returns false for the corresponding rule and the rule will not be added.

Callers 15

TestSetWatcherExFunction · 0.95
BenchmarkHasPolicySmallFunction · 0.95
BenchmarkAddPolicySmallFunction · 0.95
BenchmarkAddPolicyMediumFunction · 0.95
BenchmarkAddPolicyLargeFunction · 0.95
TestSelfModifyFunction · 0.95
BenchmarkRBACModelSmallFunction · 0.95
BenchmarkABACRuleModelFunction · 0.95
TestSetEventTypesFunction · 0.95

Calls 1

AddNamedPolicyMethod · 0.95

Tested by 15

TestSetWatcherExFunction · 0.76
BenchmarkHasPolicySmallFunction · 0.76
BenchmarkAddPolicySmallFunction · 0.76
BenchmarkAddPolicyMediumFunction · 0.76
BenchmarkAddPolicyLargeFunction · 0.76
TestSelfModifyFunction · 0.76
BenchmarkRBACModelSmallFunction · 0.76
BenchmarkABACRuleModelFunction · 0.76
TestSetEventTypesFunction · 0.76