Documentation ¶
Index ¶
- func LoadPolicyFromFS(fs http.FileSystem, path string, model model.Model) error
- func NewCachedEnforcer(fs http.FileSystem, paths ...string) (*casbin.CachedEnforcer, error)
- func NewEnforcer(fs http.FileSystem, paths ...string) (*casbin.Enforcer, error)
- func NewModel(fs http.FileSystem, path string) (model.Model, error)
- func NewSyncedEnforcer(fs http.FileSystem, paths ...string) (*casbin.SyncedEnforcer, error)
- type Adapter
- func (a *Adapter) AddPolicy(sec string, ptype string, rule []string) error
- func (a *Adapter) LoadPolicy(model model.Model) error
- func (a *Adapter) RemoveFilteredPolicy(sec string, ptype string, fid int, fvals ...string) error
- func (a *Adapter) RemovePolicy(sec string, ptype string, rule []string) error
- func (a *Adapter) SavePolicy(model model.Model) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadPolicyFromFS ¶
LoadPolicyFromFS loads all policy rules from http.FileSystem. It registers all the loaded policy rules into a specified model. This function is used by the Adapter but feel free to use it as is.
func NewCachedEnforcer ¶
func NewCachedEnforcer(fs http.FileSystem, paths ...string) (*casbin.CachedEnforcer, error)
NewCachedEnforcer returns a newly initialized CachedEnforcer instance.
func NewEnforcer ¶
func NewEnforcer(fs http.FileSystem, paths ...string) (*casbin.Enforcer, error)
NewEnforcer returns a newly initialized Enforcer instance.
func NewSyncedEnforcer ¶
func NewSyncedEnforcer(fs http.FileSystem, paths ...string) (*casbin.SyncedEnforcer, error)
NewSyncedEnforcer returns a newly initialized SyncedEnforcer instance.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
An Adapter implements the Casbin adapter for http.FileSystem.
func NewAdapter ¶
func NewAdapter(fs http.FileSystem, path string) *Adapter
NewAdapter returns a newly initialized Adapter instance.
func (*Adapter) LoadPolicy ¶
LoadPolicy loads all policy rules from the storage.
func (*Adapter) RemoveFilteredPolicy ¶
RemoveFilteredPolicy removes a policy rule from storage that matches the filter.
func (*Adapter) RemovePolicy ¶
RemovePolicy removes a policy rule from the storage.