--- TWiki.pm 28 Aug 2003 13:21:00 -0000 1.1.1.1 +++ TWiki.pm 18 Mar 2004 08:59:06 -0000 @@ -70,7 +70,7 @@ $doLogTopicView $doLogTopicEdit $doLogTopicSave $doLogRename $doLogTopicAttach $doLogTopicUpload $doLogTopicRdiff $doLogTopicChanges $doLogTopicSearch $doLogRegistration - $disableAllPlugins + $disableAllPlugins $LDAPHost $LDAPBase ); # =========================== @@ -629,86 +629,7 @@ } -# ========================= -# Get email list from WebNotify page - this now handles entries of the form: -# * Main.UserName -# * UserName -# * Main.GroupName -# * GroupName -# The 'UserName' format (i.e. no Main webname) is supported in any web, but -# is not recommended since this may make future data conversions more -# complicated, especially if used outside the Main web. %MAINWEB% is OK -# instead of 'Main'. The user's email address(es) are fetched from their -# user topic (home page) as long as they are listed in the '* Email: -# fred@example.com' format. Nested groups are supported. -sub getEmailNotifyList -{ - my( $web, $topicname ) = @_; - - $topicname = $notifyTopicname unless $topicname; - return() unless &TWiki::Store::topicExists( $web, $topicname ); - - # Allow %MAINWEB% as well as 'Main' in front of users/groups - - # non-capturing regex. - my $mainWebPattern = qr/(?:$mainWebname|%MAINWEB%)/; - - my @list = (); - my %seen; # Incremented when email address is seen - foreach ( split ( /\n/, TWiki::Store::readWebTopic( $web, $topicname ) ) ) { - if ( /^\s+\*\s(?:$mainWebPattern\.)?($wikiWordRegex)\s+\-\s+($emailAddrRegex)/o ) { - # Got full form: * Main.WikiName - email@domain - # (the 'Main.' part is optional, non-capturing) - if ( $1 ne 'TWikiGuest' ) { - # Add email address to list if non-guest and non-duplicate - push (@list, $2) unless $seen{$1}++; - } - } elsif ( /^\s+\*\s(?:$mainWebPattern\.)?($wikiWordRegex)\s*$/o ) { - # Got short form: * Main.WikiName - # (the 'Main.' part is optional, non-capturing) - my $userWikiName = $1; - foreach ( getEmailOfUser($userWikiName) ) { - # Add email address to list if it's not a duplicate - push (@list, $_) unless $seen{$_}++; - } - } - } - ##writeDebug "list of emails: @list"; - return( @list); -} - -# Get email address for a given WikiName or group, from the user's home page -sub getEmailOfUser -{ - my ($wikiName) = @_; # WikiName without web prefix - - my @list = (); - # Ignore guest entry and non-existent pages - if ( $wikiName ne "TWikiGuest" && - TWiki::Store::topicExists( $mainWebname, $wikiName ) ) { - if ( $wikiName =~ /Group$/ ) { - # Page is for a group, get all users in group - ##writeDebug "using group: $mainWebname . $wikiName"; - my @userList = TWiki::Access::getUsersOfGroup( $wikiName ); - foreach my $user ( @userList ) { - $user =~ s/^.*\.//; # Get rid of 'Main.' part. - foreach my $email ( getEmailOfUser($user) ) { - push @list, $email; - } - } - } else { - # Page is for a user - ##writeDebug "reading home page: $mainWebname . $wikiName"; - foreach ( split ( /\n/, &TWiki::Store::readWebTopic( - $mainWebname, $wikiName ) ) ) { - if (/^\s\*\sEmail:\s+([\w\-\.\+]+\@[\w\-\.\+]+)/) { - # Add email address to list - push @list, $1; - } - } - } - } - return (@list); -} + # ========================= sub initializeRemoteUser @@ -780,7 +701,7 @@ # Get the WikiName and userid, and build hashes in both directions if( ( /^\s*\* ($wikiWordRegex)\s*\-\s*([^\s]*).*/o ) && $2 ) { $wUser = $1; # WikiName - $lUser = $2; # userid + $lUser = lc($2); # userid $lUser =~ s/$securityFilter//go; # FIXME: Should filter in for security... $userToWikiList{ $lUser } = $wUser; $wikiToUserList{ $wUser } = $lUser; @@ -799,7 +720,7 @@ } $loginUser =~ s/$securityFilter//go; - my $wUser = $userToWikiList{ $loginUser } || $loginUser; + my $wUser = $userToWikiList{ lc($loginUser) } || $loginUser; if( $dontAddWeb ) { return $wUser; }