Documentation
¶
Index ¶
- 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) GetFullTableName() string
- 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
- type CasbinRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter represents the Xorm adapter for policy storage.
func NewAdapter ¶
NewAdapter is the constructor for Adapter. dataSourceAlias: Database alias. ORM will use it to switch database. driverName: database driverName. dataSourceName: connection string
func NewAdapterWithTableName ¶ added in v3.2.0
func NewAdapterWithTableName(dataSourceAlias, driverName, dataSourceName, tableName, tablePrefix string) (*Adapter, error)
NewAdapterWithTableName is the constructor for Adapter. dataSourceAlias: Database alias. ORM will use it to switch database. driverName: database driverName. dataSourceName: connection string tableName: custom table name, if tableName=="" , adapter will use default tableName "casbin_rule". tablePrefix: using table prefix
func (*Adapter) AddPolicies ¶ added in v3.1.0
AddPolicies adds multiple policy rules to the storage.
func (*Adapter) GetFullTableName ¶ added in v3.2.0
func (*Adapter) LoadPolicy ¶
LoadPolicy loads policy from database.
func (*Adapter) RemoveFilteredPolicy ¶
func (a *Adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error
RemoveFilteredPolicy removes policy rules that match the filter from the storage.
func (*Adapter) RemovePolicies ¶ added in v3.1.0
RemovePolicies removes multiple policy rules from the storage.
func (*Adapter) RemovePolicy ¶
RemovePolicy removes a policy rule from the storage.
type CasbinRule ¶
type CasbinRule struct { Id int Ptype string V0 string V1 string V2 string V3 string V4 string V5 string // contains filtered or unexported fields }
func (*CasbinRule) TableName ¶ added in v3.2.0
func (model *CasbinRule) TableName() string
TableName Beego ORM using TableNameI interface to customize table name if tableName=="" , adapter will use default tableName "casbin_rule".