[rt-users] [PATCH] Requestors must have an ID

Simon Cozens rt at netthink.co.uk
Wed Oct 17 13:38:59 EDT 2001


OK, suppose the following happens:

1) Front-line helpdesk forwards (rather than bounces) a query into RT.
2) The ticket appears with the helpdesk as requestor.
3) We delete the helpdesk and add the email address of the end user as
   requestor.
   This email address isn't an RT user at present, so RT tries to look
   it up to change the requestor ID, and fails. Requestor ID is still
   the helpdesk's ID.
4) We send correspondence, which correctly goes to the end user by email.
5) End user replies.

Now what happens? End user doesn't actually have a "user" entry in the
RT database, so when he replies, RT creates one for him. RT then
checks to see if this new user is the same as the requestor of the
ticket - which obviously it isn't, because we've established in (3)
that the ID is still the helpdesk's ID. (Trust me, we've seen this
happen here.) So the end user ends up having his mail bounced and
being told he's not actually the requestor and doesn't have permission
to correspond on the ticket.

Moral of the story? Requestors must have valid user IDs. This patch
makes it so.

--- /home/simon/rt-2-0-6/lib/RT/Watcher.pm	Tue Apr  3 07:31:14 2001
+++ RT/Watcher.pm	Wed Oct 17 17:29:20 2001
@@ -78,8 +78,25 @@
 	}
     }
     
-    
-    
+    if ($args{'Type'} eq "Requestor" and $args{'Owner'} == 0) {
+        # Requestors *MUST* have an ID.
+        my $NewUser = RT::User->new($RT::SystemUser);
+
+        my ($Val, $Message) =
+          $NewUser->Create(Name => ($Username || $Address),
+                   EmailAddress => $Address,
+                   RealName => "$Name",
+                   Password => undef,
+                   Privileged => 0,
+                   Comments => 'Autocreated on ticket submission'
+                  );
+        return (0, "Could not create watcher for requestor")
+            unless $Val;
+        if ($NewUser->id) {
+            $args{'Owner'} = $NewUser->id;
+            delete $args{'Email'};
+        }
+    }
     #Make sure we\'ve got a valid type
     #TODO --- move this to ValidateType 
     return (0, "Invalid Type")

-- 
Simon Cozens
Unix Systems Programmer
Oxford University Computer Services




More information about the rt-users mailing list