On Mon, Apr 22, 2013 at 02:44:40PM -0400, Komarinski, Mark F. wrote:
> Our Active Directory environment contains a list of email aliases for
> a user that I can query against, so I'd like to come up with a way of
> going through that database and merge users in RT to the primary
> account name. I've already installed RT-Extension-MergeUsers and can
> do it by hand, but doing this in an automated fashion would be better
> given the thousands of users we have and skip over accounts that have
> already been merged.

I'm not sure if you actually want to be checking GetMergedUsers or
looking at the EffectiveId attribute instead, but I see at least 2
problems in the code:

>     my $merged_users = $merge_user->GetMergedUsers;
>     if (grep { $_ == $email_address } @{$merged_users->Content} ) {
>       print "Accounts already merged: $email_address in $account\n";
>     }

Content is a list of ids, not Email Addresses and you can't use the
numeric compare (==) on a mixed number and string without really weird
results.

-kevin

Attachment: pgpe2V19f6jMN.pgp
Description: PGP signature

Reply via email to