diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 094c0872b..60332eeac 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -21,6 +21,7 @@ help increase shared memory amongst Apache children. (Matt Wilson) - fix [ 1488921 ] Help: Commerce, Manage - fix [ Add user to group ] typo in www_manageUsersInGroup + - fix [ 1489152 ] user to group doesn't give proper privs - Added two new mail posting properties to the collaboration system to get around a couple of problems clients have brought up. - fix [ 1435382 ] 6.8.6 always "unsubscribe" link for Admin diff --git a/lib/WebGUI/Group.pm b/lib/WebGUI/Group.pm index 91931c863..6da18ce3c 100755 --- a/lib/WebGUI/Group.pm +++ b/lib/WebGUI/Group.pm @@ -115,7 +115,6 @@ sub addGroups { my $self = shift; my $groups = shift; WebGUI::Cache->new($self->session, $self->getId)->delete; - $self->session->stow->delete("isInGroup"); foreach my $gid (@{$groups}) { next if ($gid eq '1'); next if ($gid eq $self->getId); @@ -126,7 +125,7 @@ sub addGroups { $self->session->db->write("insert into groupGroupings (groupId,inGroup) values (?,?)",[$gid, $self->getId]); } } - $self->session->stow->delete("gotGroupsInGroup"); + $self->clearCaches(); return 1; } @@ -219,7 +218,11 @@ Clears caches for this group. sub clearCaches { my $self = shift; - WebGUI::Cache->new($self->session, $self->getId)->delete; + ##Clear my cache and the cache of all groups above me. + my $groups = $self->getGroupsFor(); + foreach my $group ( $self->getId, @{ $groups } ) { + WebGUI::Cache->new($self->session, $group)->delete; + } $self->session->stow->delete("isInGroup"); $self->session->stow->delete("gotGroupsInGroup"); } @@ -781,7 +784,6 @@ sub karmaThreshold { my $self = shift; my $value = shift; if (defined $value) { - $self->clearCaches; $self->set("karmaThreshold",$value); } return $self->get("karmaThreshold"); @@ -804,7 +806,6 @@ sub ipFilter { my $self = shift; my $value = shift; if (defined $value) { - $self->clearCaches; $self->set("ipFilter",$value); } return $self->get("ipFilter"); @@ -964,7 +965,6 @@ sub dbQuery { my $self = shift; my $value = shift; if (defined $value) { - $self->clearCaches; $self->set("dbQuery",$value); } return $self->get("dbQuery"); @@ -986,7 +986,6 @@ sub databaseLinkId { my $self = shift; my $value = shift; if (defined $value) { - $self->clearCaches; $self->set("databaseLinkId",$value); } return $self->get("databaseLinkId"); @@ -1103,7 +1102,7 @@ The name of a property to set. =head3 value -THe value of a property to set. +The value of a property to set. =cut @@ -1115,6 +1114,7 @@ sub set { $self->{_group}{$name} = $value; $self->session->{groupData}->{$self->getId} = undef; $self->session->db->setRow("groups","groupId",{groupId=>$self->getId, $name=>$value, lastUpdated=>$self->session->datetime->time()}); + $self->clearCaches; } #------------------------------------------------------------------- diff --git a/t/Group.t b/t/Group.t index fba58fb73..482128a33 100644 --- a/t/Group.t +++ b/t/Group.t @@ -75,7 +75,7 @@ my @ipTests = ( ); -plan tests => (88 + scalar(@scratchTests) + scalar(@ipTests)); # increment this value for each test you create +plan tests => (90 + scalar(@scratchTests) + scalar(@ipTests)); # increment this value for each test you create my $session = WebGUI::Test->session; my $testCache = WebGUI::Cache->new($session, 'myTestKey'); @@ -470,6 +470,16 @@ foreach my $ipTest (@ipTests) { is($ipTest->{user}->isInGroup($gI->getId), $ipTest->{expect}, $ipTest->{comment}); } +##Cache check. + +my $cacheDude = WebGUI::User->new($session, "new"); +$cacheDude->username('Cache Dude'); + +$gY->addUsers([$cacheDude->userId]); + +ok( $cacheDude->isInGroup($gY->getId), "Cache dude added to group Y"); +ok( $cacheDude->isInGroup($gZ->getId), "Cache dude is a member of group Z by group membership"); + SKIP: { skip("need to test expiration date in groupings interacting with recursive or not", 1); ok(undef, "expiration date in groupings for getUser"); @@ -479,7 +489,7 @@ END { foreach my $testGroup ($gX, $gY, $gZ, $gA, $gB, $gC, $g, $gK, $gS) { $testGroup->delete if (defined $testGroup and ref $testGroup eq 'WebGUI::Group'); } - foreach my $dude ($user, @crowd, @mob, @chameleons, @itchies, @tcps) { + foreach my $dude ($user, @crowd, @mob, @chameleons, @itchies, @tcps, $cacheDude) { $dude->delete if (defined $dude and ref $dude eq 'WebGUI::User'); } $session->db->dbh->do('DROP TABLE IF EXISTS myUserTable');