%# Die, v.: %# To stop sinning suddenly. %# -- Elbert Hubbard <& /Edit/Elements/104Header, %ARGS, Buttons => [ Add => $m->scomp('/Edit/Elements/NewWindow', "Add.html?DoDelete=0&Queue=$Queue&Begin=$Begin&Report=$Report", 670, 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} || '../UserRight/') &>
% }
<& Top, Item => $Item, List => $List, Queue => $Queue, Report => $Report &>
<& List, Delete => 1, List => $List, Begin => $Begin, Item => $Item, ARGS => \%ARGS &>

<%INIT> my $List = []; my $Object = $RT::System; 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; } # Find out which users we want to display ACL selects for my $Users = RT::Users->new($session{'CurrentUser'}); $Users->Limit( FIELD => 'ExternalAuthId', OPERATOR => '!=', VALUE =>'0'); $Users->WhoHaveRight( Object => $Object, IncludeSuperusers => 0, IncludeSubgroupMembers => 0, IncludeSystemRights => 0 ); my %ToDelete = map { $_ => 1 } @ListDelete; my %OffList = map { $_ => 1 } @{$RT::Handle->dbh->selectcol_arrayref( "SELECT Id FROM Users WHERE ExternalAuthId != '0'" )}; while (my $UserObj = $Users->Next) { if ($Action eq 'Delete' and $ToDelete{$UserObj->Id}) { my $group = RT::Group->new($session{'CurrentUser'}); $group->LoadACLEquivalenceGroup($UserObj); my $ACLObj = RT::ACL->new($session{'CurrentUser'}); $ACLObj->LimitToObject( $Object ); $ACLObj->LimitToPrincipal( Id => $group->PrincipalId ); foreach my $ace (@{$ACLObj->ItemsArrayRef}) { $ace->Delete; } $User = 0; } else { push @$List, $UserObj; delete $OffList{$UserObj->Id}; } } my $Item = $RT::Nothing; if ($User) { $Item = RT::User->new($session{'CurrentUser'}); $Item->Load( $User ); } # Schwartzian transform! @$List = ( map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { [ $_ => $_->get('no') ] } @$List ); $session{UserRightList} = $List; $session{UserRightOffList} = [sort keys %OffList]; <%ARGS> $Begin => 0 $User => 0 $Queue => 0 $Report => undef $QueueObj => $RT::Nothing $Action => '' @ListDelete => () $Tab => '/Edit/Elements/Tab'