Stephen Turner wrote:
At Thursday 4/26/2007 03:31 PM, Jason Fenner wrote:
I am trying to iterate over the names of groups with this code piece:
use RT::Groups;
my $groups = new RT::Groups($user);
$groups->LimitToUserDefinedGroups();
print $groups->Count . "\n";
while (my $group = $groups->Next) {
#print $group->Id ." is a group id\n";
print $group->Name;
}
For some reason the while loop keeps resulting in false and is never
run. However, I know that I do have groups because that Count method
is returning the number 7. Does anyone know why I can't iterate?
Thanks,
--Jason
Jason,
I just ran this code and it worked for me - I wonder if $user has the
privileges to see the groups?
Steve
Yes, I solved it. The user I was using was $RT::SystemUser. That user
fails on iteration due to security filtering on the Next method in
Groups_Overlay.pm. Maybe he shouldn't fail, but he does. You correct
this by RT::User->Load a normal system user and then using that $user.
Thanks,
--Jason
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com