(t *testing.T)
| 695 | } |
| 696 | |
| 697 | func TestTemporalRolesModel(t *testing.T) { |
| 698 | e, _ := NewEnforcer("examples/rbac_with_temporal_roles_model.conf", "examples/rbac_with_temporal_roles_policy.csv") |
| 699 | |
| 700 | e.AddNamedLinkConditionFunc("g", "alice", "data2_admin", util.TimeMatchFunc) |
| 701 | e.AddNamedLinkConditionFunc("g", "alice", "data3_admin", util.TimeMatchFunc) |
| 702 | e.AddNamedLinkConditionFunc("g", "alice", "data4_admin", util.TimeMatchFunc) |
| 703 | e.AddNamedLinkConditionFunc("g", "alice", "data5_admin", util.TimeMatchFunc) |
| 704 | e.AddNamedLinkConditionFunc("g", "alice", "data6_admin", util.TimeMatchFunc) |
| 705 | e.AddNamedLinkConditionFunc("g", "alice", "data7_admin", util.TimeMatchFunc) |
| 706 | e.AddNamedLinkConditionFunc("g", "alice", "data8_admin", util.TimeMatchFunc) |
| 707 | |
| 708 | testEnforce(t, e, "alice", "data1", "read", true) |
| 709 | testEnforce(t, e, "alice", "data1", "write", true) |
| 710 | testEnforce(t, e, "alice", "data2", "read", false) |
| 711 | testEnforce(t, e, "alice", "data2", "write", false) |
| 712 | testEnforce(t, e, "alice", "data3", "read", true) |
| 713 | testEnforce(t, e, "alice", "data3", "write", true) |
| 714 | testEnforce(t, e, "alice", "data4", "read", true) |
| 715 | testEnforce(t, e, "alice", "data4", "write", true) |
| 716 | testEnforce(t, e, "alice", "data5", "read", true) |
| 717 | testEnforce(t, e, "alice", "data5", "write", true) |
| 718 | testEnforce(t, e, "alice", "data6", "read", false) |
| 719 | testEnforce(t, e, "alice", "data6", "write", false) |
| 720 | testEnforce(t, e, "alice", "data7", "read", true) |
| 721 | testEnforce(t, e, "alice", "data7", "write", true) |
| 722 | testEnforce(t, e, "alice", "data8", "read", false) |
| 723 | testEnforce(t, e, "alice", "data8", "write", false) |
| 724 | } |
| 725 | |
| 726 | func TestTemporalRolesModelWithDomain(t *testing.T) { |
| 727 | e, _ := NewEnforcer("examples/rbac_with_domain_temporal_roles_model.conf", "examples/rbac_with_domain_temporal_roles_policy.csv") |
nothing calls this directly
no test coverage detected
searching dependent graphs…