[freeside-commits] freeside/rt/lib/RT Groups_Overlay.pm, 1.2, 1.2.4.1 Record.pm, 1.4, 1.4.4.1 SearchBuilder.pm, 1.5, 1.5.4.1 Ticket_Overlay.pm, 1.7, 1.7.4.1 Transaction_Overlay.pm, 1.2, 1.2.2.1 User_Overlay.pm, 1.2, 1.2.4.1 Users_Overlay.pm, 1.2, 1.2.4.1

Ivan,,, ivan at wavetail.420.am
Thu Dec 31 04:44:27 PST 2009


Update of /home/cvs/cvsroot/freeside/rt/lib/RT
In directory wavetail.420.am:/tmp/cvs-serv8312/lib/RT

Modified Files:
      Tag: FREESIDE_1_9_BRANCH
	Groups_Overlay.pm Record.pm SearchBuilder.pm Ticket_Overlay.pm 
	Transaction_Overlay.pm User_Overlay.pm Users_Overlay.pm 
Log Message:
rt 3.6.10

Index: SearchBuilder.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/SearchBuilder.pm,v
retrieving revision 1.5
retrieving revision 1.5.4.1
diff -u -d -r1.5 -r1.5.4.1
--- SearchBuilder.pm	25 Mar 2008 02:33:43 -0000	1.5
+++ SearchBuilder.pm	31 Dec 2009 12:44:25 -0000	1.5.4.1
@@ -2,7 +2,7 @@
 # 
 # COPYRIGHT:
 #  
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC 
+# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC 
 #                                          <jesse at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
@@ -24,7 +24,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
 # 
 # 
 # CONTRIBUTION SUBMISSION POLICY:

Index: User_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/User_Overlay.pm,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -d -r1.2 -r1.2.4.1
--- User_Overlay.pm	23 Mar 2008 23:38:49 -0000	1.2
+++ User_Overlay.pm	31 Dec 2009 12:44:25 -0000	1.2.4.1
@@ -2,7 +2,7 @@
 # 
 # COPYRIGHT:
 #  
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC 
+# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC 
 #                                          <jesse at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
@@ -24,7 +24,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
 # 
 # 
 # CONTRIBUTION SUBMISSION POLICY:

Index: Groups_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Groups_Overlay.pm,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -d -r1.2 -r1.2.4.1
--- Groups_Overlay.pm	25 Mar 2008 02:52:41 -0000	1.2
+++ Groups_Overlay.pm	31 Dec 2009 12:44:24 -0000	1.2.4.1
@@ -2,7 +2,7 @@
 # 
 # COPYRIGHT:
 #  
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC 
+# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC 
 #                                          <jesse at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
@@ -24,7 +24,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
 # 
 # 
 # CONTRIBUTION SUBMISSION POLICY:

Index: Ticket_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Ticket_Overlay.pm,v
retrieving revision 1.7
retrieving revision 1.7.4.1
diff -u -d -r1.7 -r1.7.4.1
--- Ticket_Overlay.pm	18 Apr 2008 21:27:22 -0000	1.7
+++ Ticket_Overlay.pm	31 Dec 2009 12:44:25 -0000	1.7.4.1
@@ -2,7 +2,7 @@
 # 
 # COPYRIGHT:
 #  
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC 
+# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC 
 #                                          <jesse at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
@@ -24,7 +24,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
 # 
 # 
 # CONTRIBUTION SUBMISSION POLICY:
@@ -1403,52 +1403,43 @@
         @_
     );
 
-    # XXX, FIXME, BUG: if only email is provided then we only check
-    # for ModifyTicket right, but must try to get PrincipalId and
-    # check Watch* rights too if user exist
+    return ( 0, "No principal specified" )
+        unless $args{'Email'} or $args{'PrincipalId'};
+
+    if ( !$args{'PrincipalId'} and $args{'Email'} ) {
+        my $user = RT::User->new( $self->CurrentUser );
+        $user->LoadByEmail( $args{'Email'} );
+        if ( $user->id ) {
+            $args{'PrincipalId'} = $user->PrincipalId;
+            delete $args{'Email'};
+        }
+    }
 
     # {{{ Check ACLS
+    # ModifyTicket allow you to add any watcher
+    return $self->_AddWatcher(%args)
+        if $self->CurrentUserHasRight('ModifyTicket');
+
     #If the watcher we're trying to add is for the current user
-    if ( $self->CurrentUser->PrincipalId == ($args{'PrincipalId'} || 0)
-       or    lc( $self->CurrentUser->UserObj->EmailAddress )
-          eq lc( RT::User->CanonicalizeEmailAddress( $args{'Email'} ) || '' ) )
-    {
-        #  If it's an AdminCc and they don't have 
-        #   'WatchAsAdminCc' or 'ModifyTicket', bail
+    if ( $self->CurrentUser->PrincipalId == ($args{'PrincipalId'} || 0) ) {
+        #  If it's an AdminCc and they have 'WatchAsAdminCc'
         if ( $args{'Type'} eq 'AdminCc' ) {
-            unless ( $self->CurrentUserHasRight('ModifyTicket')
-                or $self->CurrentUserHasRight('WatchAsAdminCc') ) {
-                return ( 0, $self->loc('Permission Denied'))
-            }
+            return $self->_AddWatcher( %args )
+                if $self->CurrentUserHasRight('WatchAsAdminCc');
         }
 
-        #  If it's a Requestor or Cc and they don't have
-        #   'Watch' or 'ModifyTicket', bail
-        elsif ( ( $args{'Type'} eq 'Cc' ) or ( $args{'Type'} eq 'Requestor' ) ) {
-
-            unless ( $self->CurrentUserHasRight('ModifyTicket')
-                or $self->CurrentUserHasRight('Watch') ) {
-                return ( 0, $self->loc('Permission Denied'))
-            }
+        #  If it's a Requestor or Cc and they have 'Watch'
+        elsif ( $args{'Type'} eq 'Cc' || $args{'Type'} eq 'Requestor' ) {
+            return $self->_AddWatcher( %args )
+                if $self->CurrentUserHasRight('Watch');
         }
         else {
-            $RT::Logger->warning( "$self -> AddWatcher got passed a bogus type");
+            $RT::Logger->warning( "AddWatcher got passed a bogus type" );
             return ( 0, $self->loc('Error in parameters to Ticket->AddWatcher') );
         }
     }
 
-    # If the watcher isn't the current user 
-    # and the current user  doesn't have 'ModifyTicket'
-    # bail
-    else {
-        unless ( $self->CurrentUserHasRight('ModifyTicket') ) {
-            return ( 0, $self->loc("Permission Denied") );
-        }
-    }
-
-    # }}}
-
-    return ( $self->_AddWatcher(%args) );
+    return ( 0, $self->loc("Permission Denied") );
 }
 
 #This contains the meat of AddWatcher. but can be called from a routine like
@@ -2508,7 +2499,7 @@
     unless ( ($args{'MIMEObj'}->head->get('Message-ID') || '')
             =~ /<(rt-.*?-\d+-\d+)\.(\d+-0-0)\@\Q$RT::Organization>/ )
     {
-        $args{'MIMEObj'}->head->set( 'RT-Message-ID',
+        $args{'MIMEObj'}->head->replace( 'RT-Message-ID',
             "<rt-"
             . $RT::VERSION . "-"
             . $$ . "-"
@@ -3869,18 +3860,21 @@
 sub CustomFieldValues {
     my $self  = shift;
     my $field = shift;
-    if ( $field and $field !~ /^\d+$/ ) {
-        my $cf = RT::CustomField->new( $self->CurrentUser );
-        $cf->LoadByNameAndQueue( Name => $field, Queue => $self->Queue );
-        unless ( $cf->id ) {
-            $cf->LoadByNameAndQueue( Name => $field, Queue => 0 );
-        }
-        unless ( $cf->id ) {
-            # If we didn't find a valid cfid, give up.
-            return RT::CustomFieldValues->new($self->CurrentUser);
-        }
+
+    return $self->SUPER::CustomFieldValues( $field )
+        if !$field || $field =~ /^\d+$/;
+
+    my $cf = RT::CustomField->new( $self->CurrentUser );
+    $cf->LoadByNameAndQueue( Name => $field, Queue => $self->Queue );
+    unless ( $cf->id ) {
+        $cf->LoadByNameAndQueue( Name => $field, Queue => 0 );
     }
-    return $self->SUPER::CustomFieldValues($field);
+
+    # If we didn't find a valid cfid, give up.
+    return RT::ObjectCustomFieldValues->new( $self->CurrentUser )
+        unless $cf->id;
+
+    return $self->SUPER::CustomFieldValues( $cf->id );
 }
 
 # }}}

Index: Transaction_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Transaction_Overlay.pm,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- Transaction_Overlay.pm	20 Jul 2009 04:40:41 -0000	1.2
+++ Transaction_Overlay.pm	31 Dec 2009 12:44:25 -0000	1.2.2.1
@@ -2,7 +2,7 @@
 # 
 # COPYRIGHT:
 #  
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC 
+# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC 
 #                                          <jesse at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
@@ -24,7 +24,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
 # 
 # 
 # CONTRIBUTION SUBMISSION POLICY:

Index: Users_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Users_Overlay.pm,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -d -r1.2 -r1.2.4.1
--- Users_Overlay.pm	25 Mar 2008 02:52:41 -0000	1.2
+++ Users_Overlay.pm	31 Dec 2009 12:44:25 -0000	1.2.4.1
@@ -2,7 +2,7 @@
 # 
 # COPYRIGHT:
 #  
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC 
+# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC 
 #                                          <jesse at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
@@ -24,7 +24,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
 # 
 # 
 # CONTRIBUTION SUBMISSION POLICY:

Index: Record.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Record.pm,v
retrieving revision 1.4
retrieving revision 1.4.4.1
diff -u -d -r1.4 -r1.4.4.1
--- Record.pm	24 Mar 2008 03:07:59 -0000	1.4
+++ Record.pm	31 Dec 2009 12:44:24 -0000	1.4.4.1
@@ -2,7 +2,7 @@
 # 
 # COPYRIGHT:
 #  
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC 
+# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC 
 #                                          <jesse at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
@@ -24,7 +24,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
 # 
 # 
 # CONTRIBUTION SUBMISSION POLICY:



More information about the freeside-commits mailing list