Documentation ¶
Overview ¶
Copyright 2017 The casbin Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func GenerateGFunction(rm rbac.RoleManager) govaluate.ExpressionFunction
- func GetCasbin() *service
- func GlobMatch(key1 string, key2 string) (bool, error)
- func GlobMatchFunc(args ...interface{}) (interface{}, error)
- func IPMatch(ip1 string, ip2 string) bool
- func IPMatchFunc(args ...interface{}) (interface{}, error)
- func KeyMatch(key1 string, key2 string) bool
- func KeyMatch2(key1 string, key2 string) bool
- func KeyMatch2Func(args ...interface{}) (interface{}, error)
- func KeyMatch3(key1 string, key2 string) bool
- func KeyMatch3Func(args ...interface{}) (interface{}, error)
- func KeyMatch4(key1 string, key2 string) bool
- func KeyMatch4Func(args ...interface{}) (interface{}, error)
- func KeyMatchFunc(args ...interface{}) (interface{}, error)
- func NewCasbin(dbSourceName string) (*casbin.Enforcer, error)
- func RegexMatch(key1 string, key2 string) bool
- func RegexMatchFunc(args ...interface{}) (interface{}, error)
- type Casbin
Constants ¶
This section is empty.
Variables ¶
var Enforcer *casbin.Enforcer
Functions ¶
func GenerateGFunction ¶
func GenerateGFunction(rm rbac.RoleManager) govaluate.ExpressionFunction
GenerateGFunction is the factory method of the g(_, _) function.
func GlobMatchFunc ¶
func GlobMatchFunc(args ...interface{}) (interface{}, error)
GlobMatchFunc is the wrapper for GlobMatch.
func IPMatch ¶
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 ¶
func IPMatchFunc(args ...interface{}) (interface{}, error)
IPMatchFunc is the wrapper for IPMatch.
func KeyMatch ¶
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 ¶
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 ¶
func KeyMatch2Func(args ...interface{}) (interface{}, error)
KeyMatch2Func is the wrapper for KeyMatch2.
func KeyMatch3 ¶
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 ¶
func KeyMatch3Func(args ...interface{}) (interface{}, error)
KeyMatch3Func is the wrapper for KeyMatch3.
func KeyMatch4 ¶
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 ¶
func KeyMatch4Func(args ...interface{}) (interface{}, error)
KeyMatch4Func is the wrapper for KeyMatch4.
func KeyMatchFunc ¶
func KeyMatchFunc(args ...interface{}) (interface{}, error)
KeyMatchFunc is the wrapper for KeyMatch.
func RegexMatch ¶
RegexMatch determines whether key1 matches the pattern of key2 in regular expression.
func RegexMatchFunc ¶
func RegexMatchFunc(args ...interface{}) (interface{}, error)
RegexMatchFunc is the wrapper for RegexMatch.