[Rt-devel] Option for Identical Names

Matthew Ekstrand-Abueg mattea at rescomp.berkeley.edu
Tue Jun 19 17:03:15 EDT 2007

Hello all,

I have noticed that the code blocks creation of multiple users with the
same name.  This is not desirable for a large-community where people may
have the same name, but everyone still has difference email addresses.
So, as a workaround, I modified the code in the check so that if it is
trying to auto create a user with the same name, it instead takes the
email address and puts it into the name field, obviously still failing
after that if two of the same email addresses exist.

I honestly don't remember if this was a part of the LDAP_Overlay I
added, so I am mentioning this just in case that is true.

In etc/RT_SiteConfig.pm:

# Allows for multiple users to be created with the same Name
Set($AllowDuplicateNames, 1);

In lib/RT/User_Overlay.pm Create function:

if ($RT::SystemUser) {   #This only works if RT::SystemUser has been defined
    my $TempUser = RT::User->new($RT::SystemUser);
    $TempUser->Load( $args{'Name'} );
    if ( $TempUser->Id ) {
        if ( $RT::AllowDuplicateNames ) {
            $args{'Name'} = $args{'EmailAddress'};
        } else {
            return ( 0, $self->loc('Name in use') );

    return ( 0, $self->loc('Email address in use') )
      unless ( $self->ValidateEmailAddress( $args{'EmailAddress'} ) );
else {
    $RT::Logger->warning( "$self couldn't check for pre-existing users");

Notice the added internal if statements.  I hope my changes are at least
marginally helpful in resolving this issue.  Thank you very much.

Matthew Ekstrand-Abueg
Systems Administrator
Network Infrastructure, RSSP-IT
UC Berkeley

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.bestpractical.com/pipermail/rt-devel/attachments/20070619/d72b10bb/attachment.pgp

More information about the Rt-devel mailing list