A user removed from a group with deleteUsers() will still appear to be in that
group according to Inbox.pm, User::getGroupIdsRecursive() and User::getGroups(). Groups.pm wasn't clearing the cache key "getGroupsForUser" in clearCaches(). Tests and fix.
This commit is contained in:
parent
2c08b4e712
commit
867095d811
2 changed files with 9 additions and 4 deletions
|
|
@ -282,6 +282,7 @@ sub clearCaches {
|
|||
$session->stow->delete("groupObj");
|
||||
$session->stow->delete("isInGroup");
|
||||
$session->stow->delete("gotGroupsInGroup");
|
||||
$session->stow->delete("gotGroupsForUser");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
12
t/Group.t
12
t/Group.t
|
|
@ -93,7 +93,7 @@ my @ldapTests = (
|
|||
);
|
||||
|
||||
|
||||
plan tests => (164 + (scalar(@scratchTests) * 2) + scalar(@ipTests)); # increment this value for each test you create
|
||||
plan tests => (168 + (scalar(@scratchTests) * 2) + scalar(@ipTests)); # increment this value for each test you create
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
my $testCache = WebGUI::Cache->new($session, 'myTestKey');
|
||||
|
|
@ -778,11 +778,15 @@ $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");
|
||||
ok((grep $_ eq $gY->getId, @{ $cacheDude->getGroupIdsRecursive } ), 'Cache dude in Y by getGroupIdsRecursive');
|
||||
|
||||
$gY->deleteUsers([$cacheDude->userId]);
|
||||
ok(eval { $gY->deleteUsers([$cacheDude->userId]); 1; }, "Y deleteUsers on Cache dude");
|
||||
|
||||
ok( !$cacheDude->isInGroup($gY->getId), "Cache dude removed from group Y");
|
||||
ok( !$cacheDude->isInGroup($gZ->getId), "Cache dude removed from group Z too");
|
||||
ok((! grep $_ eq $gY->getId, @{ $cacheDude->getGroupIdsRecursive } ), 'Cache dude not in Y getGroupIdsRecursive');
|
||||
ok((! grep $_ eq $cacheDude->userId, @{ $gY->getAllUsers() } ), 'Cache dude not in Y getAllUsers');
|
||||
|
||||
ok( !$cacheDude->isInGroup($gY->getId), "Cache dude removed from group Y by isInGroup");
|
||||
ok( !$cacheDude->isInGroup($gZ->getId), "Cache dude removed from group Z too by isInGroup");
|
||||
|
||||
my $gCache = WebGUI::Group->new($session, "new");
|
||||
WebGUI::Test->groupsToDelete($gCache);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue