casbin

package
v0.0.50 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// casbin 初始化可能的错误
	ErrorCasbinCanNotUseDbPtr         string = "" /* 138-byte string literal not displayed */
	ErrorCasbinCreateAdaptFail        string = "casbin NewAdapterByDBUseTableName 发生错误:"
	ErrorCasbinCreateEnforcerFail     string = "casbin NewEnforcer 发生错误:"
	ErrorCasbinNewModelFromStringFail string = "NewModelFromString 调用时出错:"
	ErrorsCasbinNoAuthorization       string = "Casbin 鉴权未通过,请在后台检查 casbin 设置参数"
)

Variables

This section is empty.

Functions

func CasbinHandler

func CasbinHandler() gin.HandlerFunc

CasbinHandler 拦截器

func ErrorCasbinAuthFail

func ErrorCasbinAuthFail(c *gin.Context, msg interface{})

casbin 鉴权失败,返回 405 方法不允许访问

func Init

func Init()

func InitCasbinEnforcer

func InitCasbinEnforcer() (*casbin.SyncedEnforcer, error)

创建 Casbin Enforcer(执行器): 初始化: 1. 自动创建数据库表 2. 加载策略 3. 设置自动加载策略间隔

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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