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

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

<%INIT> my $Object = $RT::System; my $List = []; my $OffList = []; if ($Queue) { $Object = RT::Queue->new($session{'CurrentUser'}); $Object->Load($Queue) || Abort(loc("Couldn't load queue [_1]",$Queue)); } elsif ($Report) { require RTx::Report; $Object = RTx::Report->new($session{'CurrentUser'}); $Object->Load($Report) || Abort(loc("Couldn't load queue [_1]",$Queue)); } elsif (length($Report)) { require RTx::Reports; $Object = $RTx::Reports; } 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 $Report => undef $QueueObj => $RT::Nothing $Action => '' @ListDelete => () $Tab => '/Edit/Elements/Tab'