Documentation ¶
Index ¶
- type Assertion
- type AssertionMap
- type Function
- type FunctionMap
- type Model
- func (model Model) AddPolicy(sec string, ptype string, policy []string) bool
- func (model Model) BuildRoleLinks()
- func (model Model) ClearPolicy()
- func (model Model) GetFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValue 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, policy []string) bool
- func (model Model) PrintModel()
- func (model Model) PrintPolicy()
- func (model Model) RemovePolicy(sec string, ptype string, policy []string) bool
- type Role
- type RoleManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assertion ¶ added in v0.0.3
type Assertion struct { Key string Value string Tokens []string Policy [][]string RM *RoleManager }
type AssertionMap ¶
AssertionMap is the collection of assertions, can be "r", "p", "g", "e", "m".
type Function ¶ added in v0.0.2
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 ¶ added in v0.0.2
FunctionMap represents the collection of Function.
func LoadFunctionMap ¶ added in v0.0.3
func LoadFunctionMap() FunctionMap
Load an initial function map.
func (FunctionMap) AddFunction ¶ added in v0.0.3
func (fm FunctionMap) AddFunction(name string, function Function)
Add an expression function.
type Model ¶
type Model map[string]AssertionMap
Model represents the whole access control model.
func (Model) BuildRoleLinks ¶ added in v0.0.3
func (model Model) BuildRoleLinks()
Initialize the roles in RBAC.
func (Model) ClearPolicy ¶ added in v0.0.3
func (model Model) ClearPolicy()
Clear all current policy.
func (Model) GetFilteredPolicy ¶ added in v0.0.3
func (model Model) GetFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValue string) [][]string
Get rules based on a field filter from a policy.
func (Model) GetValuesForFieldInPolicy ¶ added in v0.0.3
Get all values for a field for all rules in a policy, duplicated values are removed.
type Role ¶
type Role struct {
// contains filtered or unexported fields
}
Role is the data structure for a role in RBAC.
type RoleManager ¶
type RoleManager struct {
// contains filtered or unexported fields
}
RoleManager is the interface to manage the roles in RBAC.
func (*RoleManager) GetRoles ¶ added in v0.0.3
func (rm *RoleManager) GetRoles(name string) []string
Get the roles that a subject has (aka inherits).