[Rt-commit] r7641 - in rtir/branches/2.3-EXPERIMENTAL: . t

jesse at bestpractical.com jesse at bestpractical.com
Mon Apr 23 11:38:48 EDT 2007


Author: jesse
Date: Mon Apr 23 11:38:46 2007
New Revision: 7641

Modified:
   rtir/branches/2.3-EXPERIMENTAL/   (props changed)
   rtir/branches/2.3-EXPERIMENTAL/lib/RT/IR.pm
   rtir/branches/2.3-EXPERIMENTAL/t/014-custom-field-constituency.t

Log:
 r55971 at pinglin:  jesse | 2007-04-23 11:37:53 -0400
 * Actaully add constituencies to acls
 


Modified: rtir/branches/2.3-EXPERIMENTAL/lib/RT/IR.pm
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/lib/RT/IR.pm	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/lib/RT/IR.pm	Mon Apr 23 11:38:46 2007
@@ -335,6 +335,37 @@
     };
 }
 
+
+# if (0) {
+{
+    require RT::Ticket;
+    wrap 'RT::Ticket::ACLEquivalenceObjects', pre => sub {
+        my $self = shift;
+
+        return if ( $self->CurrentUser->id == $RT::SystemUser->id );
+        my $queue = $self->QueueObj;
+        if ( UNIVERSAL::isa( $self, 'RT::Ticket' ) ) {
+            if (not defined $RT::IR::ConstituencyCache->{ $self->id }) {
+                my $systicket = RT::Ticket->new($RT::SystemUser);
+                $systicket->Load( $self->id );
+                $RT::IR::ConstituencyCache->{$self->id}  = $systicket->FirstCustomFieldValue('_RTIR_Constituency') || '_none';
+            }
+            return if ( $RT::IR::ConstituencyCache->{ $self->id } eq '_none' );
+            if ( not $self->{_constituency_queue} ) {
+                my $new_queue = RT::Queue->new( $self->CurrentUser );
+                $new_queue->LoadByCols( Name => $queue->Name . " - " . $RT::IR::ConstituencyCache->{ $self->id } );
+                return unless ( $new_queue->id );
+                $self->{_constituency_queue} = $new_queue;
+            }
+            $_[-1] =  ($queue, $self->{_constituency_queue});
+        } else {
+            use YAML;
+            $RT::Logger->crit( "$self is not a ticket object like I expected"
+                    . YAML::Dump($self) );
+        }
+    };
+}
+#
 eval "require RT::IR_Vendor";
 die $@ if ($@ && $@ !~ qr{^Can't locate RT/IR_Vendor.pm});
 eval "require RT::IR_Local";

Modified: rtir/branches/2.3-EXPERIMENTAL/t/014-custom-field-constituency.t
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/t/014-custom-field-constituency.t	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/t/014-custom-field-constituency.t	Mon Apr 23 11:38:46 2007
@@ -233,3 +233,15 @@
     is( $ticket->FirstCustomFieldValue('_RTIR_Constituency'), 'GOVNET', 'correct value' );
 }
 
+diag "Grant govhandler the right to see tickets in Incident Reports - GOVNET"
+    if $ENV{'TEST_VERBOSE'};
+diag "Grant eduhandler the right to see tickets in Incident Reports - EDUNET"
+    if $ENV{'TEST_VERBOSE'};
+diag "Create an incident report with a default constituency of EDUNET"
+    if $ENV{'TEST_VERBOSE'};
+diag "govhandler can't see the incident report"       if $ENV{'TEST_VERBOSE'};
+diag "eduhandler can see the incident report"         if $ENV{'TEST_VERBOSE'};
+diag "move the incident report from EDUNET to GOVNET" if $ENV{'TEST_VERBOSE'};
+diag "govhandler can see the incident report"         if $ENV{'TEST_VERBOSE'};
+diag "eduhandler can't see the incident report"       if $ENV{'TEST_VERBOSE'};
+


More information about the Rt-commit mailing list