%# "Nuclear war can ruin your whole compile." %# -- Karl Lehenbauer <& /Edit/Elements/104Header, Buttons => [ Add => $m->scomp('/Edit/Elements/NewWindow', "Add.html?Queue=$Queue&Begin=$Begin", 600, 365), Save => '', Delete => 1, Copy => '', Search => '', ], &> % if ($Queue) { $m->print($m->content) } else {

<& /Edit/Elements/Tab, Text => 'Global' &>
<& /Edit/Elements/Tabs, Map => $ARGS{Map}, URL => '../GroupRight/' &>
% }
<& Top, Item => $Item, List => $List, Queue => $Queue &>
<& List, Delete => sub { $_[0]->Domain eq 'UserDefined' }, List => $List, Begin => $Begin, Item => $Item, ARGS => \%ARGS &>

<%INIT> my $List = []; my $OffList = []; my $Object = $RT::System; if ($Queue) { $Object = RT::Queue->new($session{'CurrentUser'}); $Object->Load($Queue) || Abort(loc("Couldn't load queue [_1]",$Queue)); } my $Groups = RT::Groups->new($session{'CurrentUser'}); $Groups->LimitToUserDefinedGroups(); my %ToDelete = map { $_ => 1 } @ListDelete; while (my $GroupObj = $Groups->Next()) { next if $GroupObj->Description < 0; my $ACLObj = RT::ACL->new($session{'CurrentUser'}); $ACLObj->LimitToObject( $Object ); $ACLObj->LimitToPrincipal( Id => $GroupObj->PrincipalId ); if ($Action eq 'Delete' and $ToDelete{$GroupObj->Id}) { foreach my $ace (@{$ACLObj->ItemsArrayRef}) { $ace->Delete; } push @$OffList, $GroupObj; $Group = 0; } elsif ($ACLObj->Count) { push @$List, $GroupObj; } else { push @$OffList, $GroupObj; } } $Groups = RT::Groups->new($session{'CurrentUser'}); $Groups->LimitToSystemInternalGroups(); push @$List, @{$Groups->ItemsArrayRef}; $Groups = RT::Groups->new($session{'CurrentUser'}); $Groups->LimitToRolesForQueue($Queue); push @$List, @{$Groups->ItemsArrayRef}; my $Item = $RT::Nothing; if ($Group) { $Item = RT::Group->new($session{'CurrentUser'}); $Item->Load( $Group ); } $session{GroupRightList} = $List; $session{GroupRightOffList} = $OffList; <%ARGS> $Begin => 0 $Group => 0 $Queue => 0 $QueueObj => $RT::Nothing $Action => '' @ListDelete => ()