Documentation ¶
Index ¶
- Variables
- type Adapter
- func (a *Adapter) AddPolicies(sec string, ptype string, rules [][]string) error
- func (a *Adapter) AddPolicy(sec string, ptype string, rule []string) error
- func (a *Adapter) LoadPolicy(model model.Model) error
- func (a *Adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error
- func (a *Adapter) RemovePolicies(sec string, ptype string, rules [][]string) error
- func (a *Adapter) RemovePolicy(sec string, ptype string, rule []string) error
- func (a *Adapter) SavePolicy(model model.Model) error
- func (a *Adapter) UpdatePolicies(sec string, ptype string, oldPolicies, newPolicies [][]string) error
- func (a *Adapter) UpdatePolicy(sec string, ptype string, oldPolicy, newPolicy []string) error
- type Casbin
- type Enforcer
- type Rule
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissingDatabaseDriver = errors.New("missing database driver") ErrMissingDatabaseSource = errors.New("missing database source") )
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct { TableName string DatabaseDriver string DatabaseSource string // contains filtered or unexported fields }
func (*Adapter) AddPolicies ¶
Adds a policy rule to the storage.
func (*Adapter) LoadPolicy ¶
Loads all policy rules from the storage.
func (*Adapter) RemoveFilteredPolicy ¶
func (a *Adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error
Removes policy rules that match the filter from the storage.
func (*Adapter) RemovePolicies ¶
Removes a policy rule from the storage.
func (*Adapter) RemovePolicy ¶
Removes a policy rule from the storage.
func (*Adapter) SavePolicy ¶
Saves all policy rules to the storage.
type Casbin ¶
type Casbin struct { Model string // model config file path Debug bool // debug mode Enable bool // enable permission AutoLoad bool // auto load policy Duration time.Duration // auto load duration TableName string // policy table name DatabaseDriver string // database driver,support MySQL, SQLite, PostgreSQL, Oracle, SQL Server DatabaseSource string // database source url }
Click to show internal directories.
Click to hide internal directories.