Skip to content

Commit

Permalink
Item145: continue de-*wiki-ing
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@1429 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
SvenDowideit authored and SvenDowideit committed Dec 17, 2008
1 parent f415cce commit 79e7c2a
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 28 deletions.
Expand Up @@ -73,8 +73,5 @@ It's a part of the default distribution of the Foswiki Core.
| 4.2.1 | 03 Aug 2008 - Distributed with TWiki 4.2.1 |
| 4.2.0 | 22 Jan 2008 - Distributed with TWiki 4.2.0 |
| Dependencies: | %$DEPENDENCIES% |
| Contrib Home: | http://twiki.org/cgi-bin/view/Plugins/TopicUserMappingContrib |
| Feedback: | http://twiki.org/cgi-bin/view/Plugins/TopicUserMappingContribDev |


<!-- Do _not_ attempt to edit this topic; it is auto-generated. Please add comments/questions/remarks to the Dev topic instead. -->
Expand Up @@ -7,7 +7,7 @@ $Foswiki::cfg{Register}{EnableNewUserRegistration} = $TRUE;

# **BOOLEAN EXPERT**
# Hide password in registration email to the *user*
# Note that TWiki sends admins a separate confirmation.
# Note that Foswiki sends admins a separate confirmation.
$Foswiki::cfg{Register}{HidePasswd} = $TRUE;

# **BOOLEAN**
Expand Down
@@ -1,5 +1,5 @@
# Dependencies for TopicUserMappingContrib
# Example:
# Time::ParseDate,>=2003.0211,cpan,Required.
# TWiki::Plugins,>=1.15,perl,TWiki 4.1 release.
# Foswiki::Plugins,>=1.15,perl,Foswiki 1 release.

Expand Up @@ -11,7 +11,7 @@ data/Main/UserListHeader.txt 0644
data/Main/NobodyGroup.txt 0644
data/Main/UserList.txt 0644
data/Main/UserListByDateJoined.txt 0644
data/Main/AdminGroup.txt 0644 TWiki compatible admin group
data/Main/AdminGroup.txt 0644 Wiki compatible admin group
data/Main/AdminGroup.txt 0644
data/Main/UserHomepageHeader.txt 0644
data/Main/UserListByLocation.txt 0644
Expand Down
Expand Up @@ -8,7 +8,7 @@ BEGIN
$build = new Foswiki::Contrib::Build('TopicUserMappingContrib');

# (Optional) Set the details of the repository for uploads.
# This can be any web on any accessible TWiki installation.
# This can be any web on any accessible Wiki installation.
# These defaults will be used when expanding tokens in .txt
# files, but be warned, they can be overridden at upload time!

Expand Down
30 changes: 15 additions & 15 deletions TopicUserMappingContrib/lib/Foswiki/Users/TopicUserMapping.pm
Expand Up @@ -6,7 +6,7 @@
#
# Additional copyrights apply to some or all of the code in this file:
#
# Copyright (C) 2007 Sven Dowideit, SvenDowideit@distributedINFORMATION.com
# Copyright (C) 2007-2008 Sven Dowideit, SvenDowideit@distributedINFORMATION.com
# and TWiki Contributors. All Rights Reserved. Foswiki Contributors
# are listed in the AUTHORS file in the root of this distribution.
# NOTE: Please extend that file, not this notice.
Expand All @@ -27,18 +27,18 @@
---+ package Foswiki::Users::TopicUserMapping
The User mapping is the process by which TWiki maps from a username (a login name)
The User mapping is the process by which Foswiki maps from a username (a login name)
to a wikiname and back. It is also where groups are defined.
By default TWiki maintains user topics and group topics in the %MAINWEB% that
By default Foswiki maintains user topics and group topics in the %MAINWEB% that
define users and group. These topics are
* !WikiUsers - stores a mapping from usernames to TWiki names
* !WikiUsers - stores a mapping from usernames to Wiki names
* !WikiName - for each user, stores info about the user
* !GroupNameGroup - for each group, a topic ending with "Group" stores a list of users who are part of that group.
Many sites will want to override this behaviour, for example to get users and groups from a corporate database.
This class implements the basic TWiki behaviour using topics to store users,
This class implements the basic Foswiki behaviour using topics to store users,
but is also designed to be subclassed so that other services can be used.
Subclasses should be named 'XxxxUserMapping' so that configure can find them.
Expand All @@ -60,20 +60,20 @@ use Error qw( :try );
---++ ClassMethod new ($session, $impl)
Constructs a new user mapping handler of this type, referring to $session
for any required TWiki services.
for any required Foswiki services.
=cut

# The null mapping name is reserved for TWiki for backward-compatibility.
# The null mapping name is reserved for Foswiki for backward-compatibility.
# We declare this as a global variable so we can override it during testing.
our $TWIKI_USER_MAPPING_ID = '';
our $FOSWIKI_USER_MAPPING_ID = '';

#our $TWIKI_USER_MAPPING_ID = 'TestMapping_';
#our $FOSWIKI_USER_MAPPING_ID = 'TestMapping_';

sub new {
my ( $class, $session ) = @_;

my $this = $class->SUPER::new( $session, $TWIKI_USER_MAPPING_ID );
my $this = $class->SUPER::new( $session, $FOSWIKI_USER_MAPPING_ID );

my $implPasswordManager = $Foswiki::cfg{PasswordManager};
$implPasswordManager = 'Foswiki::Users::Password'
Expand Down Expand Up @@ -250,7 +250,7 @@ sub _userReallyExists {
if ( $this->{passwords}->canFetchUsers() ) {

# AllowLoginName mapping failed, maybe the user is however
# present in the TWiki managed pwd file
# present in the Wiki managed pwd file
# can use the password file if available
my $pass = $this->{passwords}->fetchPass($login);
return unless ( defined($pass) );
Expand Down Expand Up @@ -527,7 +527,7 @@ sub userExists {

return 1 if ( $loginName eq $Foswiki::cfg{DefaultUserLogin} );

# TWiki allows *groups* to log in
# Foswiki allows *groups* to log in
return 1 if ( $this->isGroup($loginName) );

# Look them up in the password manager (can be slow).
Expand Down Expand Up @@ -838,7 +838,7 @@ Only used if passwordManager->isManagingEmails= = =false
Note: This method is PUBLIC because it is used by the tools/upgrade_emails.pl
script, which needs to kick down to the mapper to retrieve email addresses
from TWiki topics.
from Wiki topics.
=cut

Expand Down Expand Up @@ -948,7 +948,7 @@ sub findUserByWikiName {

# Bloody compatibility!
# The wikiname is always a registered user for the purposes of this
# mapping. We have to do this because TWiki defines access controls
# mapping. We have to do this because Foswiki defines access controls
# in terms of mapped users, and if a wikiname is *missing* from the
# mapping there is "no such user".
push( @users, $this->login2cUID($wn) );
Expand Down Expand Up @@ -1053,7 +1053,7 @@ sub _collateGroups {
push( @{ $ref->{list} }, $group );
}

# get a list of groups defined in this TWiki
# get a list of groups defined in this Wiki
sub _getListOfGroups {
my $this = shift;
ASSERT( ref($this) eq 'Foswiki::Users::TopicUserMapping' ) if DEBUG;
Expand Down
12 changes: 6 additions & 6 deletions TopicUserMappingContrib/tools/upgrade_emails.pl
@@ -1,6 +1,6 @@
#!perl
#
# This script will iterate over the list of users in the TWiki users
# This script will iterate over the list of users in the Wiki users
# topic, recovering the email for each user (which will get the email
# from the user topic if it isn't found in the secret DB) and then
# setting the email in the secret DB. This will *not* modify the
Expand All @@ -19,7 +19,7 @@ BEGIN
use Foswiki;
use Foswiki::Users::TopicUserMapping; # required to get email addresses

my $twiki = new Foswiki();
my $foswiki = new Foswiki();

my $admin_email = $Foswiki::cfg{WebMasterEmail} || 'webmaster@example.com';
$/ = "\n";
Expand All @@ -39,10 +39,10 @@ BEGIN
};

my ($meta, $text) =
$twiki->{store}->readTopic(
$foswiki->{store}->readTopic(
undef, $Foswiki::cfg{UsersWebName}, $Foswiki::cfg{UsersTopicName} );

my $users = $twiki->{users};
my $users = $foswiki->{users};

foreach my $line ( split( /\r?\n/, $text )) {
if( $line =~ /^\s*\* ($Foswiki::regex{webNameRegex}\.)?(\w+)\s*(?:-\s*(\S+)\s*)?-\s*\d+ \w+ \d+\s*$/o ) {
Expand All @@ -60,9 +60,9 @@ BEGIN
if (scalar(@em)) {
print "Already have an address for $id\n";
} else {
# Get emails *from the TWiki user mapping manager*
# Get emails *from the Foswiki user mapping manager*
@em = Foswiki::Users::TopicUserMapping::mapper_getEmails(
$twiki, $cUID);
$foswiki, $cUID);
if( scalar( @em )) {
print "Secreting $id: ",join(';',@em),"\n";
$users->setEmails( $cUID, @em );
Expand Down

0 comments on commit 79e7c2a

Please sign in to comment.