Documentation
¶
Index ¶
- type CasbinConf
- func (l CasbinConf) MustNewCasbin(dbType string, ormDB *gorm.DB) *casbin.Enforcer
- func (l CasbinConf) MustNewCasbinWithRedisWatcher(dbType string, ormDB *gorm.DB, c redis.RedisConf) *casbin.Enforcer
- func (l CasbinConf) MustNewRedisWatcher(c redis.RedisConf, f func(string2 string)) persist.Watcher
- func (l CasbinConf) NewCasbin(dbType string, ormDB *gorm.DB) (*casbin.Enforcer, error)
- type CasbinRule
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 ¶
MustNewRedisWatcher returns redis watcher. If there are errors, it will exist. f function will be called if the policies are updated.
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
Click to show internal directories.
Click to hide internal directories.