TestOrBACModel tests the Organization-Based Access Control (OrBAC) model. OrBAC extends RBAC with abstraction layers: - Empower (g): Maps subjects to roles within organizations - Use (g2): Maps concrete actions to abstract activities within organizations - Consider (g3): Maps concrete objects to abs
(t *testing.T, e *Enforcer, sub string, org string, obj string, act string, res bool)
| 30 | // flexible and maintainable access control policies. |
| 31 | |
| 32 | func testEnforceOrBAC(t *testing.T, e *Enforcer, sub string, org string, obj string, act string, res bool) { |
| 33 | t.Helper() |
| 34 | if myRes, err := e.Enforce(sub, org, obj, act); err != nil { |
| 35 | t.Errorf("Enforce Error: %s", err) |
| 36 | } else if myRes != res { |
| 37 | t.Errorf("%s, %s, %s, %s: %t, supposed to be %t", sub, org, obj, act, myRes, res) |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | func TestOrBACModel(t *testing.T) { |
| 42 | e, err := NewEnforcer("examples/orbac_model.conf", "examples/orbac_policy.csv") |
no test coverage detected