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) 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, newRule []string) error
- type AdapterOption
- type Filter
- type Rule
Constants ¶
This section is empty.
Variables ¶
View Source
var (
Columns = Rule{
PType: "p_type",
V0: "v0",
V1: "v1",
V2: "v2",
V3: "v3",
V4: "v4",
V5: "v5",
}
)
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
func NewAdapter ¶
func NewAdapter(ctx context.Context, dbGroupName, tableName string, db gdb.DB, opts ...AdapterOption) (*Adapter, error)
NewAdapter creates a new Casbin adapter for GoFrame
func (*Adapter) AddPolicies ¶
AddPolicies adds policy rules to the storage.
func (*Adapter) IsFiltered ¶ added in v2.3.0
IsFiltered returns true if the loaded policy has been filtered.
func (*Adapter) LoadFilteredPolicy ¶ added in v2.3.0
LoadFilteredPolicy loads only policy rules that match the filter.
func (*Adapter) LoadPolicy ¶
LoadPolicy loads all policy rules from the storage.
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 ¶
RemovePolicies removes policy rules from the storage.
func (*Adapter) RemovePolicy ¶
RemovePolicy removes a policy rule from the storage.
func (*Adapter) SavePolicy ¶
SavePolicy saves all policy rules to the storage.
func (*Adapter) UpdateFilteredPolicies ¶ added in v2.3.0
func (a *Adapter) UpdateFilteredPolicies(sec string, pType string, newPolicies [][]string, fieldIndex int, fieldValues ...string) ([][]string, error)
UpdateFilteredPolicies deletes old rules and adds new rules.
func (*Adapter) UpdatePolicies ¶
UpdatePolicies updates multiple policy rules in the storage.
type AdapterOption ¶ added in v2.8.0
type AdapterOption struct {
BatchSize int
}
Click to show internal directories.
Click to hide internal directories.