[Rt-commit] rt branch, 4.0-trunk, updated. rt-4.0.0rc4-22-g4e177bb

Alex Vandiver alexmv at bestpractical.com
Mon Jan 24 19:50:40 EST 2011


The branch, 4.0-trunk has been updated
       via  4e177bb3f80a7a5777ef991dd2a7c04229f51bcf (commit)
       via  00d0791ec99185a7935de40fab963fa1934b473a (commit)
      from  d006664cc9a80278c6c3a4a9bf316c8b5aeda72e (commit)

Summary of changes:
 lib/RT/Ticket.pm                    |   22 +++++++++++-----------
 share/html/Ticket/ModifyPeople.html |    2 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

- Log -----------------------------------------------------------------
commit 00d0791ec99185a7935de40fab963fa1934b473a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jan 24 18:32:54 2011 -0500

    Allow users without Comment and Correspond rights to view the ModifyPeople page without error
    
    ->DryRun returns undef for such users; filter them out

diff --git a/share/html/Ticket/ModifyPeople.html b/share/html/Ticket/ModifyPeople.html
index 5c6844e..90c1716 100755
--- a/share/html/Ticket/ModifyPeople.html
+++ b/share/html/Ticket/ModifyPeople.html
@@ -104,7 +104,7 @@ unless ($OnlySearchForPeople or $OnlySearchForGroup) {
 }
 
 # Use the ticket's scrips to figure out the new list of recipients.
-my @txns = map {$Ticket->DryRun( Action => $_ )} qw/comment respond/;
+my @txns = grep {defined} map {$Ticket->DryRun( Action => $_ )} qw/comment respond/;
 my %recips=();
 for my $scrip (map {@{$_->Scrips->Prepared}} @txns) {
     next unless $scrip->ActionObj->Action->isa('RT::Action::SendEmail');

commit 4e177bb3f80a7a5777ef991dd2a7c04229f51bcf
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jan 24 18:49:10 2011 -0500

    Since moving the ticket my require owning it, wait until after the queue move
    
    This didn't come up previously because we relied on the ->Owner value
    on the original ticket object to remain unchanged for purposes of
    right checking.  The new rights SQL ACL query works around this,
    however -- thus, we delay the untake until after the queue move.

diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index 37e32d0..b6f3639 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -1721,16 +1721,6 @@ sub SetQueue {
             unless $new_status;
     }
 
-    unless ( $self->OwnerObj->HasRight( Right    => 'OwnTicket', Object => $NewQueueObj)) {
-        my $clone = RT::Ticket->new( RT->SystemUser );
-        $clone->Load( $self->Id );
-        unless ( $clone->Id ) {
-            return ( 0, $self->loc("Couldn't load copy of ticket #[_1].", $self->Id) );
-        }
-        my ($status, $msg) = $clone->SetOwner( RT->Nobody->Id, 'Force' );
-        $RT::Logger->error("Couldn't set owner on queue change: $msg") unless $status;
-    }
-
     if ( $new_status ) {
         my $clone = RT::Ticket->new( RT->SystemUser );
         $clone->Load( $self->Id );
@@ -1776,11 +1766,21 @@ sub SetQueue {
 
     my ($status, $msg) = $self->_Set( Field => 'Queue', Value => $NewQueueObj->Id() );
 
-
     if ( $status ) {
         # Clear the queue object cache;
         $self->{_queue_obj} = undef;
 
+        # Untake the ticket if we have no permissions in the new queue
+        unless ( $self->OwnerObj->HasRight( Right => 'OwnTicket', Object => $NewQueueObj ) ) {
+            my $clone = RT::Ticket->new( RT->SystemUser );
+            $clone->Load( $self->Id );
+            unless ( $clone->Id ) {
+                return ( 0, $self->loc("Couldn't load copy of ticket #[_1].", $self->Id) );
+            }
+            my ($status, $msg) = $clone->SetOwner( RT->Nobody->Id, 'Force' );
+            $RT::Logger->error("Couldn't set owner on queue change: $msg") unless $status;
+        }
+
         # On queue change, change queue for reminders too
         my $reminder_collection = $self->Reminders->Collection;
         while ( my $reminder = $reminder_collection->Next ) {

-----------------------------------------------------------------------


More information about the Rt-commit mailing list