Documentation
¶
Index ¶
- Constants
- Variables
- func CsvTokens(line string) ([]string, error)
- func NewCasbin(modelConf, policyConf string) (*casbin.Enforcer, error)
- func ResetPolicyString(model model.Model, s string)
- func RouterMatch(router, pattern string) bool
- func SplitLines(s string) []string
- func TimeAllow(request, policy string) bool
- func WildcardMatch(request, policy string) bool
Constants ¶
View Source
const CasbinTimeLayout = "2006-01-02 15:04:05"
CasbinTimeLayout defines the time layout used in casbin.
Variables ¶
View Source
var CasbinEpoch = time.Now()
CasbinEpoch defines the start time of casbin.
Functions ¶
func ResetPolicyString ¶
ResetPolicyString loads all policy rules from the string.
func RouterMatch ¶
func SplitLines ¶
SplitLines split string s to lines, ignore lines start with #.
func TimeAllow ¶
TimeAllow 允许运行时间 policy 格式 1. - 全部通过 2. 2020-12-31 00:00:00 截止到指定日期时间 3. 3d 自分配起3天内 4. 2020-12-31 00:00:00/2021-12-31 00:00:00 起始结束日期时间之内 5. 2020-12-31 00:00:00/3d 起始日期时间后的3天之内
func WildcardMatch ¶
WildcardMatch matches request with policy in wildcard mode. 1. - 全部通过 2. - a*/b* : a* or b*
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.