Limit inheritance policy work to the relevant scope
This commit is contained in:
@@ -114,26 +114,7 @@ func cloneInheritanceOperations(operations []inheritanceOperation) []inheritance
|
||||
}
|
||||
|
||||
func inheritancePolicyScopeAtPath(scope collectionPolicyScope, prefix Path) collectionPolicyScope {
|
||||
localized := collectionPolicyScope{}
|
||||
for _, entry := range scope.collections {
|
||||
if relative, inside := relativeHistoryPath(prefix, entry.destination); inside {
|
||||
localized.set(relative, cloneCollectionPolicyForInheritance(entry.policy))
|
||||
continue
|
||||
}
|
||||
relative, inside := relativeHistoryPath(entry.destination, prefix)
|
||||
if !inside || len(relative.segments) == 0 || relative.segments[0].kind != pathSegmentIndex {
|
||||
continue
|
||||
}
|
||||
record, found := entry.policy.recordPolicyAt(relative.segments[0].index)
|
||||
if !found {
|
||||
continue
|
||||
}
|
||||
remainder := Path{segments: append([]pathSegment(nil), relative.segments[1:]...)}
|
||||
for _, nested := range inheritancePolicyScopeAtPath(record.scope, remainder).collections {
|
||||
localized.set(nested.destination, cloneCollectionPolicyForInheritance(nested.policy))
|
||||
}
|
||||
}
|
||||
return localized
|
||||
return newInheritancePolicyIndex(scope).localize(prefix)
|
||||
}
|
||||
|
||||
func projectInheritancePolicyTemplates(templates []collectionPolicyScope, prefix Path) []projectedCollectionPolicy {
|
||||
|
||||
Reference in New Issue
Block a user