Skip to content

Commit

Permalink
Item13242: UnifiedUserMapping: add missing getEmails function
Browse files Browse the repository at this point in the history
Again, for now this is an almost exact copy from TopicUserMapping, for
now.
  • Loading branch information
jast committed Feb 5, 2015
1 parent 3392d5b commit 3548db0
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion lib/Foswiki/Users/UnifiedUserMapping.pm
Expand Up @@ -195,7 +195,37 @@ sub findUserByEmail {
) || [];
}

=begin TML
sub getEmails {
my ( $this, $user, $seen ) = @_;

$seen ||= {};

my %emails = ();

if ( $seen->{$user} ) {

#print STDERR "preventing infinit recursion in getEmails($user)\n";
}
else {
$seen->{$user} = 1;

if ( $this->isGroup($user) ) {
my $it = $this->eachGroupMember($user);
while ( $it->hasNext() ) {
foreach ( $this->getEmails( $it->next(), $seen ) ) {
$emails{$_} = 1;
}
}
}
else {
foreach ( mapper_getEmails( $this->{session}, $user ) ) {
$emails{$_} = 1;
}
}
}
return keys %emails;
}


=begin TML
Expand Down

0 comments on commit 3548db0

Please sign in to comment.