[Rt-commit] rt branch, 4.2/disallow-ticket-creation-disabled-queue, created. rt-4.0.5-283-g2986e94

Alex Vandiver alexmv at bestpractical.com
Tue Mar 13 10:07:17 EDT 2012


The branch, 4.2/disallow-ticket-creation-disabled-queue has been created
        at  2986e94f3aec84fc4d3583ebfda8725422276552 (commit)

- Log -----------------------------------------------------------------
commit 8c0e1b680013119ac083d011b1ffa36747d6ab5e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Mar 13 10:01:43 2012 -0400

    Fix the error message (copied from users) on queue disable

diff --git a/lib/RT/Queue.pm b/lib/RT/Queue.pm
index 84e2621..edc64a4 100644
--- a/lib/RT/Queue.pm
+++ b/lib/RT/Queue.pm
@@ -475,7 +475,7 @@ sub SetDisabled {
     my $set_err = $self->_Set( Field =>'Disabled', Value => $val);
     unless ($set_err) {
         $RT::Handle->Rollback();
-        $RT::Logger->warning("Couldn't ".($val == 1) ? "disable" : "enable"." queue ".$self->PrincipalObj->Id);
+        $RT::Logger->warning("Couldn't ".($val == 1) ? "disable" : "enable"." queue ".$self->Name);
         return (undef);
     }
     $self->_NewTransaction( Type => ($val == 1) ? "Disabled" : "Enabled" );

commit 2986e94f3aec84fc4d3583ebfda8725422276552
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Mar 13 10:02:29 2012 -0400

    Prohibit creating tickets in disabled queues
    
    We check if ->Disabled != 1 because ___Approvals are Disabled == 2, but
    must allow tickets to be created in them.  See 2e6dd76 and 0d17c8d.

diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index 1cd3c7d..93e0b81 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -285,7 +285,7 @@ sub Create {
         $self->CurrentUser->HasRight(
             Right  => 'CreateTicket',
             Object => $QueueObj
-        )
+        ) and $QueueObj->Disabled != 1
       )
     {
         return (
@@ -1704,7 +1704,8 @@ sub SetQueue {
     if ( $NewQueueObj->Id == $self->QueueObj->Id ) {
         return ( 0, $self->loc('That is the same value') );
     }
-    unless ( $self->CurrentUser->HasRight( Right    => 'CreateTicket', Object => $NewQueueObj)) {
+    unless ( $self->CurrentUser->HasRight( Right    => 'CreateTicket', Object => $NewQueueObj)
+         and $NewQueueObj->Disabled != 1) {
         return ( 0, $self->loc("You may not create requests in that queue.") );
     }
 

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


More information about the Rt-commit mailing list