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

Function TestMatcherUsingInOperator

enforcer_test.go:211–222  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

209}
210
211func TestMatcherUsingInOperator(t *testing.T) {
212 // From file config
213 e, _ := NewEnforcer("examples/rbac_model_matcher_using_in_op.conf")
214 _, _ = e.AddPermissionForUser("alice", "data1", "read")
215
216 testEnforce(t, e, "alice", "data1", "read", true)
217 testEnforce(t, e, "alice", "data2", "read", true)
218 testEnforce(t, e, "alice", "data3", "read", true)
219 testEnforce(t, e, "anyone", "data1", "read", false)
220 testEnforce(t, e, "anyone", "data2", "read", true)
221 testEnforce(t, e, "anyone", "data3", "read", true)
222}
223
224func TestMatcherUsingInOperatorBracket(t *testing.T) {
225 e, _ := NewEnforcer("examples/rbac_model_matcher_using_in_op_bracket.conf")

Callers

nothing calls this directly

Calls 3

AddPermissionForUserMethod · 0.95
NewEnforcerFunction · 0.85
testEnforceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…