[rt-users] Same user has several e-mail addresses

Tuc at T-B-O-H.NET ml at t-b-o-h.net
Tue May 15 12:23:21 EDT 2007


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 at cust1.example.com:cust1|support at cust1.example.com
kgnielsen at cust1.example.com:cust1|support at cust1.example.com
cal at example.com:cust1|support at cust1.example.com
sean at example.com:cust1|support at cust1.example.com
trevor at another.example.com:cust1|support at cust1.example.com
olganielsen at some.example.com:cust1|support at cust1.example.com

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


#Cust3
korey at e.example.com:cust3|clint at e.example.com
scottf at e.example.com:cust3|clint at e.example.com
ront at e.example.com:cust3|clint at e.example.com
jon at e.example.com:cust3|clint at e.example.com
marshalf at e.example.com:cust3|clint at 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 (<IN>) {
        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

> 
> 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




More information about the rt-users mailing list