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

Function NewModelFromString

model/model.go:151–160  ·  view source on GitHub ↗

NewModelFromString creates a model from a string which contains model text.

(text string)

Source from the content-addressed store, hash-verified

149
150// NewModelFromString creates a model from a string which contains model text.
151func NewModelFromString(text string) (Model, error) {
152 m := NewModel()
153
154 err := m.LoadModelFromText(text)
155 if err != nil {
156 return nil, err
157 }
158
159 return m, nil
160}
161
162// LoadModel loads the model from model CONF file.
163func (model Model) LoadModel(path string) error {

Callers 11

TestConstraintSODFunction · 0.92
TestConstraintSODMaxFunction · 0.92
TestConstraintRoleMaxFunction · 0.92
TestConstraintRolePreFunction · 0.92
TestConstraintRollbackFunction · 0.92
TestRBACModelInMemory2Function · 0.92
TestInvalidJsonRequestFunction · 0.92
TestNewModelFromStringFunction · 0.85

Calls 2

LoadModelFromTextMethod · 0.95
NewModelFunction · 0.85

Tested by 11

TestConstraintSODFunction · 0.74
TestConstraintSODMaxFunction · 0.74
TestConstraintRoleMaxFunction · 0.74
TestConstraintRolePreFunction · 0.74
TestConstraintRollbackFunction · 0.74
TestRBACModelInMemory2Function · 0.74
TestInvalidJsonRequestFunction · 0.74
TestNewModelFromStringFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…