Same user has several e-mail addresses

Hi All,

I think I saw this issue brought up in the list or on the wiki a couple (or
few) months ago, but I haven’t been able to find the posts. One of my
users is using an address (not seen before by RT) other than his
"requestor" address to reply to tickets, and his reply is going to the bit
bucker rather than being added to the ticket because RT won’t create a new
acct for him. Since this user will be a pretty regular ticket creator, I’d
like to associate both e-mail addresses to the same acct. I’d appreciate
it if someone could point me to where this was already discussed.

Thanks,
Gene

Gene LeDuc, GSEC
Security Analyst
San Diego State University

Hi All,

I think I saw this issue brought up in the list or on the wiki a couple (or
few) months ago, but I haven’t been able to find the posts. One of my users
is using an address (not seen before by RT) other than his “requestor”
address to reply to tickets, and his reply is going to the bit bucker rather
than being added to the ticket because RT won’t create a new acct for him.
Since this user will be a pretty regular ticket creator, I’d like to
associate both e-mail addresses to the same acct. I’d appreciate it if
someone could point me to where this was already discussed.

I think this was the last email in the thread.Date: Sat, 5 May 2007 14:18:49 -0400 (EDT)
From: Jon Daley
To: RT Users
Subject: Re: [rt-users] MergeUsers (was RT 4)

http://search.cpan.org/~jesse/RT-Extension-MergeUsers-0.02/

  Ah, thanks, I somehow missed that - I am not sure if it was

announced when people were discussing this a while back. I’ll try it
out.
Thanks!

I tried it out, and it does get part of the way.

First off, installation troubles:
I had to modify the test perl script in two ways:
one was to add a use lib “/usr/local/request-tracker/lib/” to get it to be
able to find RT.pm.

And then I had to change the tests, since I don’t have a “general” queue.

But, now it is installed.

I merged user1 to user2.

Sending an email from user1 creates the ticket as requested by user2, very
nice.

However, if I login as user1, I don’t have any tickets assigned.

What would be nifty is if when logging in as user1 or user2, he would
basically end up in the same place, and see all of the same tickets.

Hi Gene,

There probably is a better way... But heres the way that one of my

guys solved it many moons ago in a previous version. I’m not sure if its
the right way, if this even exists in the version you run, etc.

In the config.pm there is a section called :

LookupExternalUserInfo

At the time it allowed you to sync incoming users with an

external data source.

We put the following into it :

sub LookupExternalUserInfo {
my ($EmailAddress, $RealName) = @_;

my $FoundInExternalDatabase = undef;
my %params;

#Name is the RT username you want to use for this user.
$params{‘Name’} = $EmailAddress;
$params{‘EmailAddress’} = $EmailAddress;
$params{‘RealName’} = $RealName;

$RT::Logger->debug(“LookupExternalUserInfo: Entered with:\n”,
“\tName = $params{‘Name’}\n”,

lAddress = $params{‘EmailAddress’}\n",
“\tRealName = $params{‘RealName’}\n”,
“\tFound = $FoundInExternalDatabase\n”);

See RT’s contributed code for examples.

http://www.fsck.com/pub/rt/contrib/

$findkey= lc($EmailAddress);

tie (%fdbi,‘NDBM_File’,“/usr/local/rt2/etc/keyedfile”,O_RDWR,0777) or die $!;

if ($fdbi{$findkey}) {
$params{‘Orig’} = “$EmailAddress”;
chomp($params{‘Orig’});
($params{‘Name’},$params{‘EmailAddress’})=split(/|/,$fdbi{$findkey});
chomp($params{‘Name’});
$params{‘RealName’} = “$params{‘Name’}”;
chomp($params{‘RealName’});
chomp($params{‘EmailAddress’});
$FoundInExternalDatabase = 1;
}else {
$FoundInExternalDatabase = undef;
}

untie %fdbi;

$RT::Logger->debug("LookupExternalUserInfo: Leaving local file ",
“examination with:\n”,
“\tName = "$params{‘Name’}"\n”,
“\tEmailAddress = $params{‘EmailAddress’}\n”,
“\tRealName = $params{‘RealName’}\n”,
“\tOrig = $params{‘Orig’}\n”,
“\tFound = $FoundInExternalDatabase\n”);

return ($FoundInExternalDatabase, %params);
}

We then created a file formatted like :

#Format is ALTERNATE_EMAIL_ADDRESS:RT_LOGIN_ID|PRIMARY_EMAIL_ADDRESS

#Cust1
onielsen@cust1.example.com:cust1|support@cust1.example.com
kgnielsen@cust1.example.com:cust1|support@cust1.example.com
cal@example.com:cust1|support@cust1.example.com
sean@example.com:cust1|support@cust1.example.com
trevor@another.example.com:cust1|support@cust1.example.com
olganielsen@some.example.com:cust1|support@cust1.example.com

#Cust2
clark@more.example.com:cust2|gavin@cust2.example.com
gavin@more.example.com:cust2|gavin@cust2.example.com
brian@mail.example.com:cust2|gavin@cust2.example.com

#Cust3
korey@e.example.com:cust3|clint@e.example.com
scottf@e.example.com:cust3|clint@e.example.com
ront@e.example.com:cust3|clint@e.example.com
jon@e.example.com:cust3|clint@e.example.com
marshalf@e.example.com:cust3|clint@e.example.com

And then loaded them into the file like :

#!/usr/local/bin/perl

use Fcntl;
use NDBM_File;

$flatfile=“user.data”;

tie (%fdbi,‘NDBM_File’,“keyedfile”,O_CREAT|O_RDWR,0777) or die $!;
open(IN,“$flatfile”);

while () {
if($_ =~ /^#/) {
next;
}
if($_ =~ /^\s+/) {
next;
}
($key,$data)=split(/:/,$_);
$fdbi{$key}=$data;
}
close (IN);
untie %fdbi;

close(IN);

There was also some rt-mailgate, lib/RT/Action/Notify.pm

lib/RT/Interface/Email.pm changes needed, nothing big. Email me
directly for those.

Like I said, maybe with the newer version this is

obsolete.

	Tuc