Mailing List Archive

how to fetch queue's related groups
Hi, All,

Could someone share the examples how to collect queue's related groups?

1. I've created the groups related to queue and define rights for these
groups in the following way. It works. perl script.
....
foreach $key(keys %myHash) {
my $myGroups = RT::Group->new(RT->SystemUser);
$myGroups->_Create(Name => $key, Description => "Group for
$QueueName", Domain => "UserDefined", Type => "", Instance => 0);
foreach (@{$myHash{$key}}) {
$myGroups->PrincipalObj->GrantRight(Right => $_, Object => $myQueue);
}
}
...

2. But I can't find the examples how to select queue's related groups in
another script.

........
my $Qs = RT::Queues->new($RT::SystemUser);
$Qs->FindAllRows;
$Qs->UnLimit;

while ( my $Q = $Qs->Next ) {
my $CurQ = $Q->Name;

my $Groups = RT::Groups->new(RT->SystemUser);
$Groups->LimitToUserDefinedGroups;
... ? how to limit to $CurQ ?
while ( my $Group = $Groups->Next ) {
my $CurGroupName = $Group->Name;
print "$CurGroupName\n";
}
}

Thanks a lot for your help.

Oleksandr