RBAC with Pattern
เริ่มต้นอย่างรวดเร็ว
-
Use pattern matching in
g(_, _):e, _ := NewEnforcer("./example.conf", "./example.csv")
e.AddNamedMatchingFunc("g", "KeyMatch2", util.KeyMatch2) -
Use pattern matching with domains:
e.AddNamedDomainMatchingFunc("g", "KeyMatch2", util.KeyMatch2) -
Use both patterns together:
Simply combine both API calls.
After creating the enforcer instance, activate pattern matching using the AddNamedMatchingFunc and AddNamedDomainMatchingFunc APIs. These determine how the pattern matching is performed.
หมายเหตุ
If using the online editor, add a pattern matching function by clicking the "Add Role Matching" button in the lower left corner.
