Bugfix [ 886432 ] endless loop in group of groups
This commit is contained in:
parent
aa0bcfe693
commit
585d18da7b
2 changed files with 13 additions and 5 deletions
|
|
@ -18,6 +18,8 @@ use strict;
|
||||||
use WebGUI::DateTime;
|
use WebGUI::DateTime;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
use WebGUI::SQL;
|
use WebGUI::SQL;
|
||||||
|
use WebGUI::ErrorHandler;
|
||||||
|
use WebGUI::Utility;
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
|
|
@ -74,7 +76,8 @@ sub addGroupsToGroups {
|
||||||
foreach my $toGid (@{$_[1]}) {
|
foreach my $toGid (@{$_[1]}) {
|
||||||
my ($isIn) = WebGUI::SQL->quickArray("select count(*) from groupGroupings
|
my ($isIn) = WebGUI::SQL->quickArray("select count(*) from groupGroupings
|
||||||
where groupId=$gid and inGroup=$toGid");
|
where groupId=$gid and inGroup=$toGid");
|
||||||
unless ($isIn) {
|
my $recursive = isIn($toGid, @{getGroupsInGroup($gid,1)});
|
||||||
|
unless ($isIn || $recursive) {
|
||||||
WebGUI::SQL->write("insert into groupGroupings (groupId,inGroup) values ($gid,$toGid)");
|
WebGUI::SQL->write("insert into groupGroupings (groupId,inGroup) values ($gid,$toGid)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -257,9 +260,14 @@ sub getGroupsInGroup {
|
||||||
return undef unless $_[0];
|
return undef unless $_[0];
|
||||||
my $groups = WebGUI::SQL->buildArrayRef("select groupId from groupGroupings where inGroup=$_[0]");
|
my $groups = WebGUI::SQL->buildArrayRef("select groupId from groupGroupings where inGroup=$_[0]");
|
||||||
if ($_[1]) {
|
if ($_[1]) {
|
||||||
|
my $loopCount = $_[2]++ || 1;
|
||||||
|
if ($loopCount > 99) {
|
||||||
|
WebGUI::ErrorHandler::fatalError("Endless recursive loop detected while determinating".
|
||||||
|
" groups in group.\nRequested groupId: ".$_[0]."\nGroups in that group: ".join(",",@$groups));
|
||||||
|
}
|
||||||
my @groupsOfGroups = @$groups;
|
my @groupsOfGroups = @$groups;
|
||||||
foreach my $group (@$groups) {
|
foreach my $group (@$groups) {
|
||||||
my $gog = getGroupsInGroup($group,1);
|
my $gog = getGroupsInGroup($group,1,$loopCount);
|
||||||
push(@groupsOfGroups, @$gog);
|
push(@groupsOfGroups, @$gog);
|
||||||
}
|
}
|
||||||
return \@groupsOfGroups;
|
return \@groupsOfGroups;
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ sub www_editNavigation {
|
||||||
$config->{showUnprivilegedPages} = 0;
|
$config->{showUnprivilegedPages} = 0;
|
||||||
$config->{'reverse'} = 0;
|
$config->{'reverse'} = 0;
|
||||||
}
|
}
|
||||||
my $output = '<h1>'.WebGUI::International::get(22, 'Navigation').'</h1>';
|
my $output = helpIcon(79).'<h1>'.WebGUI::International::get(22, 'Navigation').'</h1>';
|
||||||
tie my (%tabs) , 'Tie::IxHash';
|
tie my (%tabs) , 'Tie::IxHash';
|
||||||
%tabs = (
|
%tabs = (
|
||||||
properties=>{
|
properties=>{
|
||||||
|
|
@ -270,7 +270,7 @@ sub www_editNavigationSave {
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub www_listNavigation {
|
sub www_listNavigation {
|
||||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::isInGroup(3));
|
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::isInGroup(3));
|
||||||
my $output .= '<h1>'.WebGUI::International::get(34,'Navigation').'</h1>';
|
my $output .= helpIcon(80).'<h1>'.WebGUI::International::get(34,'Navigation').'</h1>';
|
||||||
my $sth = WebGUI::SQL->read("select navigationId, identifier from Navigation order by identifier");
|
my $sth = WebGUI::SQL->read("select navigationId, identifier from Navigation order by identifier");
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
my @row = ();
|
my @row = ();
|
||||||
|
|
@ -315,7 +315,7 @@ sub www_previewNavigation {
|
||||||
<tr><td class="tableHeader" valign="top">
|
<tr><td class="tableHeader" valign="top">
|
||||||
Configuration
|
Configuration
|
||||||
</td><td class="tableHeader" valign="top">Output</td></tr>
|
</td><td class="tableHeader" valign="top">Output</td></tr>
|
||||||
<tr><td class="tableData" valign="top">
|
<tr><td class="tableHeader" valign="top">
|
||||||
<font size=1>
|
<font size=1>
|
||||||
Identifier: $session{form}{identifier}<br>
|
Identifier: $session{form}{identifier}<br>
|
||||||
startAt: $session{form}{startAt}<br>
|
startAt: $session{form}{startAt}<br>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue