Documentation
¶
Overview ¶
Package modeldiff compares two authorization models and classifies the differences between their shapes.
Index ¶
Constants ¶
const ( CostIncreased = "increased" CostDecreased = "decreased" )
Direction values are a stable part of the JSON contract.
const ( // Breaking. TypeRemoved = "type_removed" RelationRemoved = "relation_removed" DirectTypeRemoved = "direct_type_removed" ConditionRemoved = "condition_removed" ConditionParamRemoved = "condition_param_removed" ConditionParamTypeChanged = "condition_param_type_changed" // ConditionParamAdded is breaking: existing callers and stored tuple // contexts do not supply the new parameter, so checks can fail. ConditionParamAdded = "condition_param_added" // Changed. RewriteChanged = "rewrite_changed" ConditionExpressionChanged = "condition_expression_changed" SchemaVersionChanged = "schema_version_changed" // Added. TypeAdded = "type_added" RelationAdded = "relation_added" DirectTypeAdded = "direct_type_added" ConditionAdded = "condition_added" )
Kind values are stable and part of the JSON contract.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CostEntry ¶
type CostEntry struct {
Type string `json:"type"`
Relation string `json:"relation"`
Direction string `json:"direction" jsonschema:"enum=increased,enum=decreased"`
Old map[string]int `json:"old" jsonschema_description:"Weight per user type; -1 means unbounded (infinite) weight."`
New map[string]int `json:"new" jsonschema_description:"Weight per user type; -1 means unbounded (infinite) weight."`
}
CostEntry is one relation whose per-user-type weights differ between models.
type Entry ¶
type Entry struct {
Kind string `` /* 365-byte string literal not displayed */
Type string `json:"type,omitempty"`
Relation string `json:"relation,omitempty"`
Condition string `json:"condition,omitempty"`
Detail string `json:"detail"`
}
Entry is one difference between the two models.
type Result ¶
type Result struct {
Breaking []Entry `json:"breaking"`
Changed []Entry `json:"changed"`
Added []Entry `json:"added"`
// Cost lists relations whose per-user-type weights differ.
Cost []CostEntry `json:"cost"`
// CostSkipped explains why Cost could not be computed.
CostSkipped string `json:"costSkipped,omitempty"`
}
Result groups the differences by severity.
func (Result) HasCostIncrease ¶
HasCostIncrease reports whether any relation got more expensive.