acl

package
v1.3.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

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 CsvTokens

func CsvTokens(line string) ([]string, error)

CsvTokens spits line as CSV string.

func NewCasbin

func NewCasbin(modelConf, policyConf string) (*casbin.Enforcer, error)

NewCasbin create a casbin object with model and policy string.

func ResetPolicyString

func ResetPolicyString(model model.Model, s string)

ResetPolicyString loads all policy rules from the string.

func RouterMatch

func RouterMatch(router, pattern string) bool

func SplitLines

func SplitLines(s string) []string

SplitLines split string s to lines, ignore lines start with #.

func TimeAllow

func TimeAllow(request, policy string) bool

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

func WildcardMatch(request, policy string) bool

WildcardMatch matches request with policy in wildcard mode. 1. - 全部通过 2. - a*/b* : a* or b*

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL