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
[EMAIL PROTECTED]:cust1|[EMAIL PROTECTED]
[EMAIL PROTECTED]:cust1|[EMAIL PROTECTED]
[EMAIL PROTECTED]:cust1|[EMAIL PROTECTED]
[EMAIL PROTECTED]:cust1|[EMAIL PROTECTED]
[EMAIL PROTECTED]:cust1|[EMAIL PROTECTED]
[EMAIL PROTECTED]:cust1|[EMAIL PROTECTED]

#Cust2
[EMAIL PROTECTED]:cust2|[EMAIL PROTECTED]
[EMAIL PROTECTED]:cust2|[EMAIL PROTECTED]
[EMAIL PROTECTED]:cust2|[EMAIL PROTECTED]


#Cust3
[EMAIL PROTECTED]:cust3|[EMAIL PROTECTED]
[EMAIL PROTECTED]:cust3|[EMAIL PROTECTED]
[EMAIL PROTECTED]:cust3|[EMAIL PROTECTED]
[EMAIL PROTECTED]:cust3|[EMAIL PROTECTED]
[EMAIL PROTECTED]:cust3|[EMAIL PROTECTED]


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

_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Reply via email to