Documentation ¶
Index ¶
- type Adapter
- func (adapter *Adapter) AddPolicies(sec string, ptype string, rules [][]string) error
- func (adapter *Adapter) AddPolicy(sec string, ptype string, rule []string) error
- func (adapter *Adapter) LoadPolicy(cmodel casbinModel.Model) error
- func (adapter *Adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error
- func (adapter *Adapter) RemovePolicies(sec string, ptype string, rules [][]string) error
- func (adapter *Adapter) RemovePolicy(sec string, ptype string, rule []string) error
- func (adapter *Adapter) SavePolicy(cmodel casbinModel.Model) error
- type FilteredAdapter
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 is a postgresql adaptor for casbin
func NewAdapter ¶
NewAdapter returns a new casbin postgresql adapter
func NewAdapterWithDBSchema ¶
NewAdapterWithDBSchema returns a new casbin postgresql adapter with the schema named dbSchema
func (*Adapter) AddPolicies ¶
AddPolicies adds policy rules to the storage. This is part of the Auto-Save feature.
func (*Adapter) AddPolicy ¶
AddPolicy adds a policy rule to the storage. This is part of the Auto-Save feature.
func (*Adapter) LoadPolicy ¶
func (adapter *Adapter) LoadPolicy(cmodel casbinModel.Model) error
LoadPolicy loads all policy rules from the storage.
func (*Adapter) RemoveFilteredPolicy ¶
func (adapter *Adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error
RemoveFilteredPolicy removes policy rules that match the filter from the storage. This is part of the Auto-Save feature.
func (*Adapter) RemovePolicies ¶
RemovePolicies removes policy rules from the storage. This is part of the Auto-Save feature.
func (*Adapter) RemovePolicy ¶
RemovePolicy removes a policy rule from the storage. This is part of the Auto-Save feature.
func (*Adapter) SavePolicy ¶
func (adapter *Adapter) SavePolicy(cmodel casbinModel.Model) error
SavePolicy saves all policy rules to the storage.
type FilteredAdapter ¶
type FilteredAdapter struct { *Adapter // contains filtered or unexported fields }
FilteredAdapter is the filtered file adapter for Casbin. It can load policy from file or save policy to file and supports loading of filtered policies.
func NewFilteredAdapter ¶
func NewFilteredAdapter(db *sql.DB, tableName string) (*FilteredAdapter, error)
NewFilteredAdapter is the constructor for FilteredAdapter.
func NewFilteredAdapterWithDBSchema ¶
func NewFilteredAdapterWithDBSchema(db *sql.DB, dbSchema string, tableName string) (*FilteredAdapter, error)
NewFilteredAdapterWithDBSchema return a pointer for FilteredAdapter which has schema dbSchema
func (*FilteredAdapter) IsFiltered ¶
func (a *FilteredAdapter) IsFiltered() bool
IsFiltered returns true if the loaded policy has been filtered.
func (*FilteredAdapter) LoadFilteredPolicy ¶
func (a *FilteredAdapter) LoadFilteredPolicy(mod casbinModel.Model, filter interface{}) error
LoadFilteredPolicy loads only policy rules that match the filter.
func (*FilteredAdapter) LoadPolicy ¶
func (a *FilteredAdapter) LoadPolicy(model casbinModel.Model) error
LoadPolicy loads all policy rules from the storage.
func (*FilteredAdapter) SavePolicy ¶
func (a *FilteredAdapter) SavePolicy(model casbinModel.Model) error
SavePolicy saves all policy rules to the storage.