跳转至主要内容

RBAC with Conditions API

一个更加用户友好的带有条件的RBAC API。

参考

AddNamedLinkConditionFunc

AddNamedLinkConditionFunc为链接userName->roleName添加条件函数fn,当fn返回true时,链接有效,否则无效

e.AddNamedLinkConditionFunc("g", "userName", "roleName", YourLinkConditionFunc)

AddNamedDomainLinkConditionFunc

AddNamedDomainLinkConditionFunc为链接userName-> {roleName, domain}添加条件函数fn,当fn返回true时,链接有效,否则无效

e.AddNamedDomainLinkConditionFunc("g", "userName", "roleName", "domainName", YourLinkConditionFunc)

SetNamedLinkConditionFuncParams

SetNamedLinkConditionFuncParams为链接userName->roleName设置条件函数fn的参数

e.SetNamedLinkConditionFuncParams("g", "userName", "roleName", "YourConditionFuncParam")
e.SetNamedLinkConditionFuncParams("g", "userName2", "roleName2", "YourConditionFuncParam_1", "YourConditionFuncParam_2")

SetNamedDomainLinkConditionFuncParams

SetNamedDomainLinkConditionFuncParams为链接userName->{roleName, domain}设置条件函数fn的参数

e.SetNamedDomainLinkConditionFuncParams("g", "userName", "roleName", "domainName", "YourConditionFuncParam")
e.SetNamedDomainLinkConditionFuncParams("g", "userName2", "roleName2", "domainName2", "YourConditionFuncParam_1", "YourConditionFuncParam_2")