casbin

package
v0.0.0-...-7428ece Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CasbinConf

type CasbinConf struct {
	ModelText string `json:"ModelText,optional,env=CASBIN_MODEL_TEXT"`
}

CasbinConf is the configuration structure for Casbin

func (CasbinConf) MustNewCasbin

func (l CasbinConf) MustNewCasbin(dbType string, ormDB *gorm.DB) *casbin.Enforcer

MustNewCasbin returns Casbin enforcer. If there are errors, it will exist.

func (CasbinConf) MustNewCasbinWithRedisWatcher

func (l CasbinConf) MustNewCasbinWithRedisWatcher(dbType string, ormDB *gorm.DB, c redis.RedisConf) *casbin.Enforcer

MustNewCasbinWithRedisWatcher returns Casbin Enforcer with Redis watcher.

func (CasbinConf) MustNewRedisWatcher

func (l CasbinConf) MustNewRedisWatcher(c redis.RedisConf, f func(string2 string)) persist.Watcher

MustNewRedisWatcher returns redis watcher. If there are errors, it will exist. f function will be called if the policies are updated.

func (CasbinConf) NewCasbin

func (l CasbinConf) NewCasbin(dbType string, ormDB *gorm.DB) (*casbin.Enforcer, error)

NewCasbin returns Casbin enforcer.

type CasbinRule

type CasbinRule struct {
	ID    uint   `gorm:"primaryKey;autoIncrement"`
	Ptype string `gorm:"size:100;uniqueIndex:unique_index"`
	V0    string `gorm:"size:100;uniqueIndex:unique_index"`
	V1    string `gorm:"size:100;uniqueIndex:unique_index"`
	V2    string `gorm:"size:100"`
	V3    string `gorm:"size:100"`
	V4    string `gorm:"size:100"`
	V5    string `gorm:"size:100"`
}

func (CasbinRule) TableName

func (CasbinRule) TableName() string

Jump to

Keyboard shortcuts

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