@@ -769,6 +769,19 @@ func TestTemporalRolesModelWithDomain(t *testing.T) {
769769 testDomainEnforce (t , e , "alice" , "domain_not_exist" , "data8" , "write" , false )
770770}
771771
772+ func TestTemporalRolesModelWithDomainTransitive (t * testing.T ) {
773+ e , _ := NewEnforcer ("examples/rbac_with_domain_temporal_roles_model.conf" , "examples/rbac_with_domain_temporal_roles_transitive_policy.csv" )
774+
775+ e .AddNamedDomainLinkConditionFunc ("g" , "alice" , "role_mid" , "domainx" , util .TimeMatchFunc )
776+ e .AddNamedDomainLinkConditionFunc ("g" , "role_mid" , "role_top" , "domainx" , util .TimeMatchFunc )
777+ e .AddNamedDomainLinkConditionFunc ("g" , "alice" , "role_solo" , "domainx" , util .TimeMatchFunc )
778+
779+ // single-hop expired link -> correctly denied (control)
780+ testDomainEnforce (t , e , "alice" , "domainx" , "data_solo" , "read" , false )
781+ // two-hop chain whose 2nd link is expired -> must be denied as well
782+ testDomainEnforce (t , e , "alice" , "domainx" , "data_top" , "read" , false )
783+ }
784+
772785func TestReBACModel (t * testing.T ) {
773786 e , _ := NewEnforcer ("examples/rebac_model.conf" , "examples/rebac_policy.csv" )
774787
0 commit comments