Documentation ¶
Index ¶
- Constants
- type Adapter
- func (a *Adapter) AddPolicy(sec, ptype string, rule []string) error
- func (a *Adapter) LoadPolicy(m model.Model) error
- func (a *Adapter) RemoveFilteredPolicy(sec, ptype string, fieldIndex int, fieldValues ...string) error
- func (a *Adapter) RemovePolicy(sec, ptype string, rule []string) error
- func (a *Adapter) SavePolicy(m model.Model) error
- type Config
- type FuncDisabler
Constants ¶
View Source
const ( // DefaultModelText 默认 casbin 模型文本 DefaultModelText = `` /* 232-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
Routes []string
}
Adapter 决策规则适配器
func (*Adapter) RemoveFilteredPolicy ¶
func (a *Adapter) RemoveFilteredPolicy(sec, ptype string, fieldIndex int, fieldValues ...string) error
RemoveFilteredPolicy 移除筛选后的决策规则
func (*Adapter) RemovePolicy ¶
RemovePolicy 移除决策规则
type Config ¶
type Config struct { DisabledAPIs []string `json:",optional"` // API 禁用列表 DisabledRPCs []string `json:",optional"` // RPC 禁用列表 }
Config 功能禁用器配置
type FuncDisabler ¶
type FuncDisabler struct {
// contains filtered or unexported fields
}
FuncDisabler 功能禁用器
func MustNewFuncDisabler ¶
func MustNewFuncDisabler(c Config) *FuncDisabler
MustNewFuncDisabler 新建功能禁用器
func NewFuncDisabler ¶
func NewFuncDisabler(c Config) (*FuncDisabler, error)
NewFuncDisabler 新建功能禁用器
func (*FuncDisabler) AllowAPI ¶
func (fd *FuncDisabler) AllowAPI(method, api string) bool
AllowAPI 是否允许放行该 API 请求
func (*FuncDisabler) AllowRPC ¶
func (fd *FuncDisabler) AllowRPC(rpc string) bool
AllowRPC 是否允许放行该 RPC 请求
Click to show internal directories.
Click to hide internal directories.