RBAC with Conditions API
一个更加用户友好的带有条件的RBAC API。
参考
AddNamedLinkConditionFunc
AddNamedLinkConditionFunc
为链接userName->roleName
添加条件函数fn,当fn返回true时,链接有效,否则无效
- Go
e.AddNamedLinkConditionFunc("g", "userName", "roleName", YourLinkConditionFunc)
AddNamedDomainLinkConditionFunc
AddNamedDomainLinkConditionFunc
为链接userName-> {roleName, domain}
添加条件函数fn,当fn返回true时,链接有效,否则无效
- Go
e.AddNamedDomainLinkConditionFunc("g", "userName", "roleName", "domainName", YourLinkConditionFunc)
SetNamedLinkConditionFuncParams
SetNamedLinkConditionFuncParams
为链接userName->roleName
设置条件函数fn的参数
- Go
e.SetNamedLinkConditionFuncParams("g", "userName", "roleName", "YourConditionFuncParam")
e.SetNamedLinkConditionFuncParams("g", "userName2", "roleName2", "YourConditionFuncParam_1", "YourConditionFuncParam_2")
SetNamedDomainLinkConditionFuncParams
SetNamedDomainLinkConditionFuncParams
为链接userName->{roleName, domain}
设置条件函数fn的参数
- Go
e.SetNamedDomainLinkConditionFuncParams("g", "userName", "roleName", "domainName", "YourConditionFuncParam")
e.SetNamedDomainLinkConditionFuncParams("g", "userName2", "roleName2", "domainName2", "YourConditionFuncParam_1", "YourConditionFuncParam_2")