Documentation
¶
Index ¶
- Constants
- type IModel
- type Model
- func (m *Model) AddRule(rule []string) (bool, error)
- func (m *Model) BuildMatcher(key string) error
- func (m *Model) BuildMatcherFromDef(mDef *defs.MatcherDef) (matcher.IMatcher, error)
- func (m *Model) BuildMatchers() error
- func (m *Model) ClearPolicy(pKey string) error
- func (m *Model) GetDef(sec byte, key string) (defs.IDef, bool)
- func (m *Model) GetEffector(key string) (e.IEffector, bool)
- func (m *Model) GetMatcher(key string) (matcher.IMatcher, bool)
- func (m *Model) GetPolicy(key string) (policy.IPolicy, bool)
- func (m *Model) GetRequestDef(key string) (*defs.RequestDef, bool)
- func (m *Model) GetRoleManager(key string) (rbac.IRoleManager, bool)
- func (m *Model) LoadModel(path string) error
- func (m *Model) LoadModelFromText(text string) error
- func (m *Model) RangeMatches(matcher matcher.IMatcher, rDef *defs.RequestDef, rvals []interface{}, ...) error
- func (m *Model) RangeRules(fn func(rule []string) bool)
- func (m *Model) RemoveDef(sec byte, key string) error
- func (m *Model) RemoveFunction(name string) bool
- func (m *Model) RemoveRule(rule []string) (bool, error)
- func (m *Model) SetDef(sec byte, key string, value string) error
- func (m *Model) SetEffector(key string, effector e.IEffector)
- func (m *Model) SetFunction(name string, function govaluate.ExpressionFunction)
- func (m *Model) SetMatcher(key string, matcher matcher.IMatcher)
- func (m *Model) SetPolicy(key string, policy policy.IPolicy)
- func (m *Model) SetRequestDef(key string, def *defs.RequestDef)
- func (m *Model) SetRoleManager(key string, rm rbac.IRoleManager)
- func (m *Model) String() string
- type SectionDef
Constants ¶
View Source
const ( RULE_ADDED = "rule_added" RULE_REMOVED = "rule_removed" )
View Source
const ( R_SEC = 'r' P_SEC = 'p' G_SEC = 'g' M_SEC = 'm' E_SEC = 'e' )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IModel ¶
type IModel interface { api.IAddRuleBool api.IRemoveRuleBool api.IRangeRules api.IAddRemoveListener GetDef(sec byte, key string) (defs.IDef, bool) SetDef(sec byte, key string, value string) error RemoveDef(sec byte, key string) error GetRoleManager(key string) (rbac.IRoleManager, bool) SetRoleManager(key string, rm rbac.IRoleManager) GetPolicy(key string) (p.IPolicy, bool) SetPolicy(key string, policy p.IPolicy) GetEffector(key string) (e.IEffector, bool) SetEffector(key string, eft e.IEffector) GetMatcher(key string) (m.IMatcher, bool) SetMatcher(key string, matcher m.IMatcher) GetRequestDef(key string) (*defs.RequestDef, bool) SetRequestDef(key string, def *defs.RequestDef) ClearPolicy(key string) error SetFunction(name string, function govaluate.ExpressionFunction) RemoveFunction(name string) bool BuildMatcherFromDef(mDef *defs.MatcherDef) (matcher.IMatcher, error) RangeMatches(matcher matcher.IMatcher, rDef *defs.RequestDef, rvals []interface{}, fn func(rule []string) bool) error String() string }
type Model ¶
func NewModelFromFile ¶
func (*Model) BuildMatcher ¶
func (*Model) BuildMatcherFromDef ¶
func (*Model) BuildMatchers ¶
func (*Model) ClearPolicy ¶
func (*Model) GetRequestDef ¶
func (m *Model) GetRequestDef(key string) (*defs.RequestDef, bool)
func (*Model) GetRoleManager ¶
func (m *Model) GetRoleManager(key string) (rbac.IRoleManager, bool)
func (*Model) LoadModelFromText ¶
LoadModelFromText loads the model from the text.
func (*Model) RangeMatches ¶
func (*Model) RangeRules ¶
func (*Model) RemoveFunction ¶
func (*Model) SetFunction ¶
func (m *Model) SetFunction(name string, function govaluate.ExpressionFunction)
func (*Model) SetRequestDef ¶
func (m *Model) SetRequestDef(key string, def *defs.RequestDef)
func (*Model) SetRoleManager ¶
func (m *Model) SetRoleManager(key string, rm rbac.IRoleManager)
type SectionDef ¶
type SectionDef struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.