utils

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCasBinTable        = "casbin_rule"
	DefaultCasBinDatabase     = "public"
	DefaultCasBinConfPath     = "etc/rbac_model.conf"
	DefaultCasBinWatchChannel = "casbin"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CasBinConf

type CasBinConf struct {
	ConfPath       string   `json:",default=etc/rbac_model.conf"`
	WatcherChannel string   `json:",default=casbin"`
	WhiteList      []string `json:",default=[]"`
}

type CasBinTool

type CasBinTool interface {
	GetAdapter() *pgxadapter.PgxAdapter
	GetEnforcer() *casbin.Enforcer
	GetWatcher() persist.Watcher
	GetToolDatabaseName() string
	GetToolTableName() string
	SetFilter(in []pgxadapter.Filter)
	SetRedisConfig(in *rexStore.RedisConfig)
	NewWatcher(watchChannel string, watchCallback func(enforcer *casbin.Enforcer, msg string)) error
	Bootstrap() error
	Reload() error
	CheckPermission(vals ...interface{}) (bool, error)
}

func EasyNewCasBinTool

func EasyNewCasBinTool(dc *pgxpool.Config) CasBinTool

func EasyNewCasBinWatchTool

func EasyNewCasBinWatchTool(dc *pgxpool.Config, rc *rexStore.RedisConfig, watchChannel string, watchCallback func(enforcer *casbin.Enforcer, msg string)) CasBinTool

func NewCasBinTool

func NewCasBinTool(dc *pgxpool.Config, rc *rexStore.RedisConfig, databaseName, tableName, confPath string, watchChannel string, watchCallback func(enforcer *casbin.Enforcer, msg string)) CasBinTool

func NewFullCasBinTool

func NewFullCasBinTool(dc *pgxpool.Config, rc *rexStore.RedisConfig, customDatabaseName, customTableName, confPath string, isFiltered bool, filters []pgxadapter.Filter, isWatching bool, watchChannel string, watchCallback func(enforcer *casbin.Enforcer, msg string)) CasBinTool

Jump to

Keyboard shortcuts

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