Documentation ¶
Index ¶
- func InitializeCasbin(db *sqlx.DB) error
- func Policy() *casbin.SyncedEnforcer
- type CasbinRule
- type IAdapter
- type PGCasbinAdapter
- func (a *PGCasbinAdapter) AddPolicy(sec string, ptype string, rule []string) error
- func (a *PGCasbinAdapter) LoadPolicy(model model.Model) error
- func (a *PGCasbinAdapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error
- func (a *PGCasbinAdapter) RemovePolicy(sec string, ptype string, rule []string) error
- func (a *PGCasbinAdapter) SavePolicy(model model.Model) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeCasbin ¶
Types ¶
type CasbinRule ¶
type IAdapter ¶
type IAdapter interface { // LoadPolicy loads all policy rules from the storage. LoadPolicy(model model.Model) error // SavePolicy saves all policy rules to the storage. SavePolicy(model model.Model) error // AddPolicy adds a policy rule to the storage. // This is part of the Auto-Save feature. AddPolicy(sec string, ptype string, rule []string) error // RemovePolicy removes a policy rule from the storage. // This is part of the Auto-Save feature. RemovePolicy(sec string, ptype string, rule []string) error // RemoveFilteredPolicy removes policy rules that match the filter from the storage. // This is part of the Auto-Save feature. RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error }
type PGCasbinAdapter ¶
type PGCasbinAdapter struct {
// contains filtered or unexported fields
}
func NewCasbinAdapter ¶
func NewCasbinAdapter(db *sqlx.DB, schema string) *PGCasbinAdapter
func (*PGCasbinAdapter) AddPolicy ¶
func (a *PGCasbinAdapter) AddPolicy(sec string, ptype string, rule []string) error
func (*PGCasbinAdapter) LoadPolicy ¶
func (a *PGCasbinAdapter) LoadPolicy(model model.Model) error
func (*PGCasbinAdapter) RemoveFilteredPolicy ¶
func (*PGCasbinAdapter) RemovePolicy ¶
func (a *PGCasbinAdapter) RemovePolicy(sec string, ptype string, rule []string) error
func (*PGCasbinAdapter) SavePolicy ¶
func (a *PGCasbinAdapter) SavePolicy(model model.Model) error
Click to show internal directories.
Click to hide internal directories.