fixed: Collab groupToEditPost shouldn't be empty

fixed: WebGUI::User->isInGroup has bad defaulting behavior
This commit is contained in:
Doug Bell 2009-02-17 23:21:30 +00:00
parent ffdb86de81
commit 30158b7f8d
3 changed files with 24 additions and 3 deletions

View file

@ -636,7 +636,7 @@ The group that you wish to verify against the user. Defaults to group with Id 3
sub isInGroup {
my (@data, $groupId);
my ($self, $gid, $secondRun) = @_;
$gid = 3 unless (defined $gid);
$gid = 3 unless $gid;
my $uid = $self->userId;
### The following several checks are to increase performance. If this section were removed, everything would continue to work as normal.
#my $eh = $self->session->errorHandler;
@ -650,8 +650,9 @@ sub isInGroup {
return $isInGroup->{$uid}{$gid} if exists $isInGroup->{$uid}{$gid};
### Lookup the actual groupings.
my $group = WebGUI::Group->new($self->session,$gid);
# Cope with non-existant groups. Default to the admin group if the groupId is invalid.
$group = WebGUI::Group->new($self->session, 3) unless $group;
if ( !$group ) {
$group = WebGUI::Group->new($self->session,3);
}
### Check for groups of groups.
my $users = $group->getAllUsers();
foreach my $user (@{$users}) {