From ad85d802fe2d019757469c0d3f34f15c8fba1db5 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Wed, 17 Oct 2007 00:53:49 +0000 Subject: [PATCH] lineage protection --- lib/WebGUI/AssetLineage.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/WebGUI/AssetLineage.pm b/lib/WebGUI/AssetLineage.pm index 26bb60aeb..b5c37f4c1 100644 --- a/lib/WebGUI/AssetLineage.pm +++ b/lib/WebGUI/AssetLineage.pm @@ -364,10 +364,7 @@ sub getLineage { # now lets add in all of the siblings in every level between ourself and the asset we wish to pedigree if (isIn("pedigree",@{$relatives}) && exists $rules->{assetToPedigree}) { my $pedigreeLineage = $rules->{assetToPedigree}->get("lineage"); - if (substr($pedigreeLineage,0,length($lineage)) ne $lineage) { - push @whereModifiers, '0'; - } - else { + if (substr($pedigreeLineage,0,length($lineage)) eq $lineage) { my @mods; my $length = $rules->{assetToPedigree}->getLineageLength; for (my $i = $length; $i > 0; $i--) { @@ -427,7 +424,10 @@ sub getLineage { $where .= ' and (asset.className in ('.$self->session->db->quoteAndJoin($rules->{includeOnlyClasses}).'))'; } ## finish up our where clause - $where .= ' and ('.join(" or ",@whereModifiers).')' if (scalar(@whereModifiers)); + if (!scalar(@whereModifiers)) { + return []; + } + $where .= ' and ('.join(" or ",@whereModifiers).')'; if (exists $rules->{whereClause} && $rules->{whereClause}) { $where .= ' and ('.$rules->{whereClause}.')'; }