Documentation
¶
Overview ¶
Package rules contains all rules related logic.
Index ¶
Constants ¶
const NoMatchingRuleIndex = -1
NoMatchingRuleIndex is the rule index used when no rule matched and the default policy was applied.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthorizationResult ¶ added in v0.5.2
AuthorizationResult contains the result of an authorization check with metadata. RuleIndex is NoMatchingRuleIndex if the default policy was used.
func (AuthorizationResult) Allowed ¶ added in v0.5.2
func (r AuthorizationResult) Allowed() bool
Allowed reports whether the result permits access.
func (AuthorizationResult) IsDefaultPolicy ¶ added in v0.5.2
func (r AuthorizationResult) IsDefaultPolicy() bool
IsDefaultPolicy reports whether the default policy was applied.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the access control engine that checks if a given query is allowed by the rules.
func NewEngine ¶
func NewEngine(config *config.AccessControl) *Engine
NewEngine creates a new access control engine for the given access control configuration.
func (*Engine) Authorize ¶
func (e *Engine) Authorize(query *Query) AuthorizationResult
Authorize checks if the given query is allowed by the engine's rules and returns detailed result including which rule matched.
func (*Engine) UpdateConfig ¶
func (e *Engine) UpdateConfig(config *config.AccessControl)
UpdateConfig updates the engine's configuration with the given access control configuration.