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

Function LoadPolicyLine

persist/adapter.go:25–41  ·  view source on GitHub ↗

LoadPolicyLine loads a text line as a policy rule to model.

(line string, m model.Model)

Source from the content-addressed store, hash-verified

23
24// LoadPolicyLine loads a text line as a policy rule to model.
25func LoadPolicyLine(line string, m model.Model) error {
26 if line == "" || strings.HasPrefix(line, "#") {
27 return nil
28 }
29
30 r := csv.NewReader(strings.NewReader(line))
31 r.Comma = ','
32 r.Comment = '#'
33 r.TrimLeadingSpace = true
34
35 tokens, err := r.Read()
36 if err != nil {
37 return err
38 }
39
40 return LoadPolicyArray(tokens, m)
41}
42
43// LoadPolicyArray loads a policy rule to model.
44func LoadPolicyArray(rule []string, m model.Model) error {

Callers 1

LoadPolicyMethod · 0.92

Calls 1

LoadPolicyArrayFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…