casbin: github.com/casbin/casbin/util Index | Files

package util

import "github.com/casbin/casbin/util"

Index

Package Files

builtin_operators.go util.go

func Array2DEquals Uses

func Array2DEquals(a [][]string, b [][]string) bool

Array2DEquals determines whether two 2-dimensional string arrays are identical.

func ArrayEquals Uses

func ArrayEquals(a []string, b []string) bool

ArrayEquals determines whether two string arrays are identical.

func ArrayRemoveDuplicates Uses

func ArrayRemoveDuplicates(s *[]string)

ArrayRemoveDuplicates removes any duplicated elements in a string array.

func ArrayToString Uses

func ArrayToString(s []string) string

ArrayToString gets a printable string for a string array.

func EscapeAssertion Uses

func EscapeAssertion(s string) string

EscapeAssertion escapes the dots in the assertion, because the expression evaluation doesn't support such variable names.

func GenerateGFunction Uses

func GenerateGFunction(rm rbac.RoleManager) govaluate.ExpressionFunction

GenerateGFunction is the factory method of the g(_, _) function.

func GetEvalValue Uses

func GetEvalValue(s string) []string

GetEvalValue returns the parameters of function eval

func GlobMatch Uses

func GlobMatch(key1 string, key2 string) (bool, error)

GlobMatch determines whether key1 matches the pattern of key2 using glob pattern

func GlobMatchFunc Uses

func GlobMatchFunc(args ...interface{}) (interface{}, error)

GlobMatchFunc is the wrapper for GlobMatch.

func HasEval Uses

func HasEval(s string) bool

HasEval determine whether matcher contains function eval

func IPMatch Uses

func IPMatch(ip1 string, ip2 string) bool

IPMatch determines whether IP address ip1 matches the pattern of IP address ip2, ip2 can be an IP address or a CIDR pattern. For example, "192.168.2.123" matches "192.168.2.0/24"

func IPMatchFunc Uses

func IPMatchFunc(args ...interface{}) (interface{}, error)

IPMatchFunc is the wrapper for IPMatch.

func JoinSlice Uses

func JoinSlice(a string, b ...string) []string

JoinSlice joins a string and a slice into a new slice.

func JoinSliceAny Uses

func JoinSliceAny(a string, b ...string) []interface{}

JoinSliceAny joins a string and a slice into a new interface{} slice.

func KeyMatch Uses

func KeyMatch(key1 string, key2 string) bool

KeyMatch determines whether key1 matches the pattern of key2 (similar to RESTful path), key2 can contain a *. For example, "/foo/bar" matches "/foo/*"

func KeyMatch2 Uses

func KeyMatch2(key1 string, key2 string) bool

KeyMatch2 determines whether key1 matches the pattern of key2 (similar to RESTful path), key2 can contain a *. For example, "/foo/bar" matches "/foo/*", "/resource1" matches "/:resource"

func KeyMatch2Func Uses

func KeyMatch2Func(args ...interface{}) (interface{}, error)

KeyMatch2Func is the wrapper for KeyMatch2.

func KeyMatch3 Uses

func KeyMatch3(key1 string, key2 string) bool

KeyMatch3 determines whether key1 matches the pattern of key2 (similar to RESTful path), key2 can contain a *. For example, "/foo/bar" matches "/foo/*", "/resource1" matches "/{resource}"

func KeyMatch3Func Uses

func KeyMatch3Func(args ...interface{}) (interface{}, error)

KeyMatch3Func is the wrapper for KeyMatch3.

func KeyMatch4 Uses

func KeyMatch4(key1 string, key2 string) bool

KeyMatch4 determines whether key1 matches the pattern of key2 (similar to RESTful path), key2 can contain a *. Besides what KeyMatch3 does, KeyMatch4 can also match repeated patterns: "/parent/123/child/123" matches "/parent/{id}/child/{id}" "/parent/123/child/456" does not match "/parent/{id}/child/{id}" But KeyMatch3 will match both.

func KeyMatch4Func Uses

func KeyMatch4Func(args ...interface{}) (interface{}, error)

KeyMatch4Func is the wrapper for KeyMatch4.

func KeyMatchFunc Uses

func KeyMatchFunc(args ...interface{}) (interface{}, error)

KeyMatchFunc is the wrapper for KeyMatch.

func ParamsToString Uses

func ParamsToString(s ...string) string

ParamsToString gets a printable string for variable number of parameters.

func RegexMatch Uses

func RegexMatch(key1 string, key2 string) bool

RegexMatch determines whether key1 matches the pattern of key2 in regular expression.

func RegexMatchFunc Uses

func RegexMatchFunc(args ...interface{}) (interface{}, error)

RegexMatchFunc is the wrapper for RegexMatch.

func RemoveComments Uses

func RemoveComments(s string) string

RemoveComments removes the comments starting with # in the text.

func ReplaceEval Uses

func ReplaceEval(s string, rule string) string

ReplaceEval replace function eval with the value of its parameters

func SetEquals Uses

func SetEquals(a []string, b []string) bool

SetEquals determines whether two string sets are identical.

func SetSubtract Uses

func SetSubtract(a []string, b []string) []string

SetSubtract returns the elements in `a` that aren't in `b`.

Package util imports 9 packages (graph) and is imported by 32 packages. Updated 2020-06-04. Refresh now. Tools for package owners.