Documentation ¶
Index ¶
- type Assertion
- type AssertionMap
- type Function
- type FunctionMap
- type Model
- func (model Model) AddDef(sec string, key string, value string) bool
- func (model Model) AddPolicy(sec string, ptype string, rule []string) bool
- func (model Model) BuildRoleLinks()
- func (model Model) ClearPolicy()
- func (model Model) GetFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) [][]string
- func (model Model) GetPolicy(sec string, ptype string) [][]string
- func (model Model) GetValuesForFieldInPolicy(sec string, ptype string, fieldIndex int) []string
- func (model Model) HasPolicy(sec string, ptype string, rule []string) bool
- func (model Model) LoadModel(path string)
- func (model Model) LoadModelFromText(text string)
- func (model Model) PrintModel()
- func (model Model) PrintPolicy()
- func (model Model) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) bool
- func (model Model) RemovePolicy(sec string, ptype string, rule []string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assertion ¶
type Assertion struct { Key string Value string Tokens []string Policy [][]string RM *rbac.RoleManager }
Assertion represents an expression in a section of the model. For example: r = sub, obj, act
type AssertionMap ¶
AssertionMap is the collection of assertions, can be "r", "p", "g", "e", "m".
type Function ¶
type Function func(args ...interface{}) (interface{}, error)
Function represents a function that is used in the matchers, used to get attributes in ABAC.
type FunctionMap ¶
FunctionMap represents the collection of Function.
func LoadFunctionMap ¶
func LoadFunctionMap() FunctionMap
LoadFunctionMap loads an initial function map.
func (FunctionMap) AddFunction ¶
func (fm FunctionMap) AddFunction(name string, function Function)
AddFunction adds an expression function.
type Model ¶
type Model map[string]AssertionMap
Model represents the whole access control model.
func (Model) BuildRoleLinks ¶
func (model Model) BuildRoleLinks()
BuildRoleLinks initializes the roles in RBAC.
func (Model) GetFilteredPolicy ¶
func (model Model) GetFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) [][]string
GetFilteredPolicy gets rules based on field filters from a policy.
func (Model) GetValuesForFieldInPolicy ¶
GetValuesForFieldInPolicy gets all values for a field for all rules in a policy, duplicated values are removed.
func (Model) LoadModelFromText ¶ added in v0.9.0
LoadModelFromText loads the model from the text.