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) HasTable(name string) (bool, error)
- func (a *Adapter) IsFiltered() bool
- func (a *Adapter) LoadFilteredPolicy(model model.Model, filter interface{}) 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) UpdateFilteredPolicies(sec string, ptype string, newPolicies [][]string, fieldIndex int, ...) ([][]string, error)
- func (a *Adapter) UpdatePolicies(sec string, ptype string, oldRules, newRules [][]string) error
- func (a *Adapter) UpdatePolicy(sec string, ptype string, oldRule, newPolicy []string) error
- type CasbinRule
- type Filter
- type Logger
- func (l *Logger) EnableLog(enable bool)
- func (l *Logger) IsEnabled() bool
- func (l *Logger) LogEnforce(matcher string, request []interface{}, result bool, explains [][]string)
- func (l *Logger) LogError(err error, msg ...string)
- func (l *Logger) LogModel(model [][]string)
- func (l *Logger) LogPolicy(policy map[string][][]string)
- func (l *Logger) LogRole(roles []string)
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 Gorm adapter for policy store.
func NewAdapter ¶
NewAdapter is the constructor for Adapter.
func (*Adapter) AddPolicies ¶
AddPolicies adds multiple policy rules to the store.
func (*Adapter) IsFiltered ¶
IsFiltered returns true if the loaded policy has been filtered.
func (*Adapter) LoadFilteredPolicy ¶
LoadFilteredPolicy loads only policy rules that match the filter.
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 store.
func (*Adapter) RemovePolicies ¶
RemovePolicies removes multiple policy rules from the store.
func (*Adapter) RemovePolicy ¶
RemovePolicy removes a policy rule from the store.
func (*Adapter) SavePolicy ¶
SavePolicy saves policy to database.
func (*Adapter) UpdateFilteredPolicies ¶
func (*Adapter) UpdatePolicies ¶
type CasbinRule ¶
type CasbinRule struct { ID uint `orm:"id" json:"id"` PType string `orm:"p_type" json:"p_type"` V0 string `orm:"v0" json:"v0"` V1 string `orm:"v1" json:"v1"` V2 string `orm:"v2" json:"v2"` V3 string `orm:"v3" json:"v3"` V4 string `orm:"v4" json:"v4"` V5 string `orm:"v5" json:"v5"` V6 string `orm:"v6" json:"v6"` V7 string `orm:"v7" json:"v7"` }
func (CasbinRule) TableName ¶
func (CasbinRule) TableName() string
type Logger ¶
Logger is the implementation for a Logger using golang log.
func (*Logger) LogEnforce ¶
func (l *Logger) LogEnforce(matcher string, request []interface{}, result bool, explains [][]string)
LogEnforce log info related to enforce.