[rt-users] Merging users?

darren chamberlain darren at boston.com
Tue Dec 3 10:58:49 EST 2002


* Lynoure Rajamki <lynoure at otaverkko.fi> [2002-12-03 01:38]:
> On Tue, 2002-12-03 at 00:35, Sebastian Flothow wrote:
> > > Is there a way for merging the auto-created user
> > > hank.helpdesker at helpdeskers.com with the 'real' hank?
> > 
> > Maybe the address canonicalization (in the config file) does the
> > trick?
> 
> I guess hank was a bad example. The typical pair of addresses used is
> nickname at domain and firstname.lastname at domain, so if I understood
> right, canonicalization would do the trick only if I'd know which
> addresses will and should be used and hardcode those into config.pm.

If you control the domain, and maintain the aliases file (assuming your
MTA uses an aliases file), you can use my Mail::ExpandAliases module (on
CPAN) in CanonicalizeAddress:

  use Mail::ExpandAliases;
  use Mail::Address;
  my $ma = Mail::ExpandAliases->new("/etc/aliases");

  sub CanonicalizeAddress {
      my $email = shift;
      my ($address, $username, @aliases);

      $address = Mail::Address->new($email);
      $username = $address->user();

      @aliases = $ma->expand($username);

      return $aliases[0];
  }

So nickname at domain will turn into firstname.lastname.  You can modify
the return line to be:

    return join "@", $aliases[0], $address->host();

if you are using "firstname.lastname at domain"-style usernames in RT.

> I can think of no regular expression that would do the job and anyway,
> canonicalization probably doesn't help at the point where you have
> multiple users of one person already.

Yes, this is true, although you can (hopefully) prevent any new aliases
for a user from coming into being.

(darren)

-- 
Man is condemned to be free; because once thrown into the world, he is
for everything he does.
    -- Jean-Paul Sartre



More information about the rt-users mailing list