Documentation ¶
Index ¶
- type Adapter
- func (this *Adapter) AddPolicies(sec string, ptype string, rules [][]string) error
- func (this *Adapter) AddPolicy(sec string, ptype string, rule []string) error
- func (this *Adapter) Close() error
- func (this *Adapter) IsFiltered() bool
- func (this *Adapter) LoadFilteredPolicy(model model.Model, filter any) error
- func (this *Adapter) LoadPolicy(model model.Model) error
- func (this *Adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error
- func (this *Adapter) RemovePolicies(sec string, ptype string, rules [][]string) error
- func (this *Adapter) RemovePolicy(sec string, ptype string, rule []string) error
- func (this *Adapter) SavePolicy(model model.Model) error
- func (this *Adapter) UpdatePolicy(sec string, ptype string, oldRule, newPolicy []string) error
- func (this *Adapter) WithModel(model *Rules) *Adapter
- type Filter
- type Rules
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
*
- gorm 适配器 *
- rbac_model.conf 中 matchers 内置可用函数:
- keyMatch [匹配*号], keyMatch2 [匹配 :file]
- regexMatch [正则匹配], ipMatch [IP地址或者CIDR匹配] *
- @create 2021-9-8
- @author deatil
func (*Adapter) AddPolicies ¶
AddPolicies adds multiple policy rules to the storage.
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 (this *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 multiple policy rules from the storage.
func (*Adapter) RemovePolicy ¶
RemovePolicy removes a policy rule from the storage.
func (*Adapter) SavePolicy ¶
SavePolicy saves policy to database.
func (*Adapter) UpdatePolicy ¶
UpdatePolicy updates a new policy rule to DB.
type Filter ¶
type Filter struct { PType []string V0 []string V1 []string V2 []string V3 []string V4 []string V5 []string }
过滤
type Rules ¶
type Rules struct { ID string `gorm:"primaryKey;autoIncrement:false;size:36"` Ptype string `gorm:"size:250;"` V0 string `gorm:"size:250;"` V1 string `gorm:"size:250;"` V2 string `gorm:"size:250;"` V3 string `gorm:"size:250;"` V4 string `gorm:"size:250;"` V5 string `gorm:"size:250;"` }
规则模型
Click to show internal directories.
Click to hide internal directories.