← Index
NYTProf Performance Profile   « line view »
For ./view
  Run on Fri Jul 31 18:42:36 2015
Reported on Fri Jul 31 18:48:15 2015

Filename/var/www/foswikidev/core/lib/Foswiki/Users/BaseUserMapping.pm
StatementsExecuted 5642 statements in 5.97ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1077222.61ms2.61msFoswiki::Users::BaseUserMapping::::handlesUserFoswiki::Users::BaseUserMapping::handlesUser
1111.13ms1.22msFoswiki::Users::BaseUserMapping::::BEGIN@33Foswiki::Users::BaseUserMapping::BEGIN@33
111779µs833µsFoswiki::Users::BaseUserMapping::::BEGIN@40Foswiki::Users::BaseUserMapping::BEGIN@40
6211120µs120µsFoswiki::Users::BaseUserMapping::::isGroupFoswiki::Users::BaseUserMapping::isGroup
11166µs74µsFoswiki::Users::BaseUserMapping::::newFoswiki::Users::BaseUserMapping::new
11142µs46µsFoswiki::Users::BaseUserMapping::::finishFoswiki::Users::BaseUserMapping::finish
11113µs26µsFoswiki::Users::BaseUserMapping::::BEGIN@30Foswiki::Users::BaseUserMapping::BEGIN@30
11112µs55µsFoswiki::Users::BaseUserMapping::::BEGIN@37Foswiki::Users::BaseUserMapping::BEGIN@37
11112µs39µsFoswiki::Users::BaseUserMapping::::BEGIN@36Foswiki::Users::BaseUserMapping::BEGIN@36
11112µs24µsFoswiki::Users::BaseUserMapping::::eachGroupMemberFoswiki::Users::BaseUserMapping::eachGroupMember
11111µs84µsFoswiki::Users::BaseUserMapping::::isAdminFoswiki::Users::BaseUserMapping::isAdmin
11110µs27µsFoswiki::Users::BaseUserMapping::::BEGIN@39Foswiki::Users::BaseUserMapping::BEGIN@39
1119µs13µsFoswiki::Users::BaseUserMapping::::BEGIN@31Foswiki::Users::BaseUserMapping::BEGIN@31
1115µs5µsFoswiki::Users::BaseUserMapping::::BEGIN@42Foswiki::Users::BaseUserMapping::BEGIN@42
1114µs4µsFoswiki::Users::BaseUserMapping::::BEGIN@38Foswiki::Users::BaseUserMapping::BEGIN@38
2114µs4µsFoswiki::Users::BaseUserMapping::::login2cUIDFoswiki::Users::BaseUserMapping::login2cUID
1113µs3µsFoswiki::Users::BaseUserMapping::::getWikiNameFoswiki::Users::BaseUserMapping::getWikiName
1113µs3µsFoswiki::Users::BaseUserMapping::::getLoginNameFoswiki::Users::BaseUserMapping::getLoginName
0000s0sFoswiki::Users::BaseUserMapping::::__ANON__[:350]Foswiki::Users::BaseUserMapping::__ANON__[:350]
0000s0sFoswiki::Users::BaseUserMapping::::checkPasswordFoswiki::Users::BaseUserMapping::checkPassword
0000s0sFoswiki::Users::BaseUserMapping::::eachGroupFoswiki::Users::BaseUserMapping::eachGroup
0000s0sFoswiki::Users::BaseUserMapping::::eachMembershipFoswiki::Users::BaseUserMapping::eachMembership
0000s0sFoswiki::Users::BaseUserMapping::::eachUserFoswiki::Users::BaseUserMapping::eachUser
0000s0sFoswiki::Users::BaseUserMapping::::findUserByWikiNameFoswiki::Users::BaseUserMapping::findUserByWikiName
0000s0sFoswiki::Users::BaseUserMapping::::getEmailsFoswiki::Users::BaseUserMapping::getEmails
0000s0sFoswiki::Users::BaseUserMapping::::groupAllowsChangeFoswiki::Users::BaseUserMapping::groupAllowsChange
0000s0sFoswiki::Users::BaseUserMapping::::loginTemplateNameFoswiki::Users::BaseUserMapping::loginTemplateName
0000s0sFoswiki::Users::BaseUserMapping::::passwordErrorFoswiki::Users::BaseUserMapping::passwordError
0000s0sFoswiki::Users::BaseUserMapping::::setPasswordFoswiki::Users::BaseUserMapping::setPassword
0000s0sFoswiki::Users::BaseUserMapping::::userExistsFoswiki::Users::BaseUserMapping::userExists
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# See bottom of file for license and copyright information
2
3=begin TML
4
5---+ package Foswiki::Users::BaseUserMapping
6
7User mapping is the process by which Foswiki maps from a username
8(a login name)
9to a display name and back. It is also where groups are maintained.
10
11The BaseMapper provides support for a small number of predefined users.
12No registration - this is a read only usermapper. It uses the mapper
13prefix 'BaseUserMapping_'.
14
15---++ Users
16 * $Foswiki::cfg{AdminUserLogin} - uses the password that
17 was set in Configure (IF its not null)
18 * $Foswiki::cfg{DefaultUserLogin} - WikiGuest
19 * UnknownUser
20 * ProjectContributor
21 * $Foswiki::cfg{Register}{RegistrationAgentWikiName}
22
23---+++ Groups
24 * $Foswiki::cfg{SuperAdminGroup}
25 * BaseGroup
26
27=cut
28
29package Foswiki::Users::BaseUserMapping;
30227µs238µs
# spent 26µs (13+12) within Foswiki::Users::BaseUserMapping::BEGIN@30 which was called: # once (13µs+12µs) by Foswiki::Store::Rcs::Handler::BEGIN@50 at line 30
use strict;
# spent 26µs making 1 call to Foswiki::Users::BaseUserMapping::BEGIN@30 # spent 12µs making 1 call to strict::import
31223µs217µs
# spent 13µs (9+4) within Foswiki::Users::BaseUserMapping::BEGIN@31 which was called: # once (9µs+4µs) by Foswiki::Store::Rcs::Handler::BEGIN@50 at line 31
use warnings;
# spent 13µs making 1 call to Foswiki::Users::BaseUserMapping::BEGIN@31 # spent 4µs making 1 call to warnings::import
32
332126µs11.22ms
# spent 1.22ms (1.13+87µs) within Foswiki::Users::BaseUserMapping::BEGIN@33 which was called: # once (1.13ms+87µs) by Foswiki::Store::Rcs::Handler::BEGIN@50 at line 33
use Foswiki::UserMapping ();
# spent 1.22ms making 1 call to Foswiki::Users::BaseUserMapping::BEGIN@33
3418µsour @ISA = ('Foswiki::UserMapping');
35
36227µs265µs
# spent 39µs (12+27) within Foswiki::Users::BaseUserMapping::BEGIN@36 which was called: # once (12µs+27µs) by Foswiki::Store::Rcs::Handler::BEGIN@50 at line 36
use Assert;
# spent 39µs making 1 call to Foswiki::Users::BaseUserMapping::BEGIN@36 # spent 27µs making 1 call to Exporter::import
37228µs299µs
# spent 55µs (12+43) within Foswiki::Users::BaseUserMapping::BEGIN@37 which was called: # once (12µs+43µs) by Foswiki::Store::Rcs::Handler::BEGIN@50 at line 37
use Encode;
# spent 55µs making 1 call to Foswiki::Users::BaseUserMapping::BEGIN@37 # spent 43µs making 1 call to Exporter::import
38223µs14µs
# spent 4µs within Foswiki::Users::BaseUserMapping::BEGIN@38 which was called: # once (4µs+0s) by Foswiki::Store::Rcs::Handler::BEGIN@50 at line 38
use Error ();
# spent 4µs making 1 call to Foswiki::Users::BaseUserMapping::BEGIN@38
39227µs244µs
# spent 27µs (10+17) within Foswiki::Users::BaseUserMapping::BEGIN@39 which was called: # once (10µs+17µs) by Foswiki::Store::Rcs::Handler::BEGIN@50 at line 39
use Digest::MD5 qw(md5_hex);
# spent 27µs making 1 call to Foswiki::Users::BaseUserMapping::BEGIN@39 # spent 17µs making 1 call to Exporter::import
402200µs2860µs
# spent 833µs (779+54) within Foswiki::Users::BaseUserMapping::BEGIN@40 which was called: # once (779µs+54µs) by Foswiki::Store::Rcs::Handler::BEGIN@50 at line 40
use Crypt::PasswdMD5 qw(apache_md5_crypt);
# spent 833µs making 1 call to Foswiki::Users::BaseUserMapping::BEGIN@40 # spent 26µs making 1 call to Exporter::import
41
42
# spent 5µs within Foswiki::Users::BaseUserMapping::BEGIN@42 which was called: # once (5µs+0s) by Foswiki::Store::Rcs::Handler::BEGIN@50 at line 47
BEGIN {
4315µs if ( $Foswiki::cfg{UseLocale} ) {
44 require locale;
45 import locale();
46 }
4711.23ms15µs}
# spent 5µs making 1 call to Foswiki::Users::BaseUserMapping::BEGIN@42
48
491300nsour $DEFAULT_USER_CUID = 'BaseUserMapping_666';
501200nsour $UNKNOWN_USER_CUID = 'BaseUserMapping_999';
511200nsour %BASE_USERS;
521100nsour %BASE_GROUPS;
53
54=begin TML
55
56---++ ClassMethod new ($session)
57
58Construct the BaseUserMapping object
59
60=cut
61
62# Constructs a new user mapping handler of this type, referring to $session
63# for any required Foswiki services.
64
# spent 74µs (66+8) within Foswiki::Users::BaseUserMapping::new which was called: # once (66µs+8µs) by Foswiki::Users::new at line 93 of /var/www/foswikidev/core/lib/Foswiki/Users.pm
sub new {
651900ns my ( $class, $session ) = @_;
66
67 # $DEFAULT_USER_CUID , $UNKNOWN_USER_CUID, %BASE_USERS and %BASE_GROUPS
68 # could be initialised statically, but tests have been written that rely
69 # on being able to override the $Foswiki::cfg settings that are part of
70 # them. Since it's a low cost op to re-initialise them each time this
71 # singleton is built, we will contiue to do so (at least until those
72 # tests have been revisited)
731300ns $DEFAULT_USER_CUID = 'BaseUserMapping_666';
741100ns $UNKNOWN_USER_CUID = 'BaseUserMapping_999';
75112µs %BASE_USERS = (
76 BaseUserMapping_111 => {
77 login => 'ProjectContributor',
78 wikiname => 'ProjectContributor',
79 },
80 BaseUserMapping_222 => {
81 login => $Foswiki::cfg{Register}{RegistrationAgentWikiName}
82 || 'RegistrationAgent',
83 wikiname => $Foswiki::cfg{Register}{RegistrationAgentWikiName}
84 || 'RegistrationAgent',
85 },
86 BaseUserMapping_333 => {
87 login => $Foswiki::cfg{AdminUserLogin} || 'admin',
88 wikiname => $Foswiki::cfg{AdminUserWikiName} || 'AdminUser',
89 email => $Foswiki::cfg{WebMasterEmail} || 'email not set',
90 password => $Foswiki::cfg{Password},
91 },
92 $DEFAULT_USER_CUID => {
93 login => $Foswiki::cfg{DefaultUserLogin} || 'guest',
94 wikiname => $Foswiki::cfg{DefaultUserWikiName} || 'WikiGuest',
95 },
96 $UNKNOWN_USER_CUID => {
97 login => 'unknown',
98 wikiname => 'UnknownUser',
99 }
100 );
10114µs %BASE_GROUPS = (
102 $Foswiki::cfg{SuperAdminGroup} => [
103 'BaseUserMapping_333',
104
105# Registration agent was here so registration can still take
106# place on an otherwise locked down USERSWEB.
107# Jan2010: Sven removed it, otherwise anyone registering can add themselves as admin.
108#'BaseUserMapping_222'
109 ],
110 BaseGroup => [
111 'BaseUserMapping_333', $DEFAULT_USER_CUID,
112 $UNKNOWN_USER_CUID, 'BaseUserMapping_111',
113 'BaseUserMapping_222',
114 ],
115
116 # RegistrationGroup => ['BaseUserMapping_222']
117 );
118
119116µs18µs my $this = $class->SUPER::new( $session, 'BaseUserMapping_' );
# spent 8µs making 1 call to Foswiki::UserMapping::new
1201600ns $Foswiki::cfg{Register}{RegistrationAgentWikiName} ||= 'RegistrationAgent';
121
122 # set up our users
1231500ns $this->{L2U} = {}; # login 2 cUID
1241400ns $this->{U2L} = {}; # cUID 2 login
1251300ns $this->{W2U} = {}; # wikiname 2 cUID
1261300ns $this->{U2W} = {}; # cUID 2 wikiname
1271300ns $this->{U2E} = {}; # cUID 2 email
1281700ns $this->{L2P} = {}; # login 2 password
129
13016µs while ( my ( $k, $v ) = each %BASE_USERS ) {
13153µs $this->{U2L}->{$k} = $v->{login};
13252µs $this->{U2W}->{$k} = $v->{wikiname};
13352µs $this->{U2E}->{$k} = $v->{email} if defined $v->{email};
134
13554µs $this->{L2U}->{ $v->{login} } = $k;
13651µs $this->{L2P}->{ $v->{login} } = $v->{password}
137 if defined $v->{password};
138
13954µs $this->{W2U}->{ $v->{wikiname} } = $k;
140 }
141
14212µs %{ $this->{GROUPS} } = %BASE_GROUPS;
143
14414µs return $this;
145}
146
147=begin TML
148
149---++ ObjectMethod finish()
150Break circular references.
151
152=cut
153
154# Note to developers; please undef *all* fields in the object explicitly,
155# whether they are references or not. That way this method is "golden
156# documentation" of the live fields in the object.
157
# spent 46µs (42+4) within Foswiki::Users::BaseUserMapping::finish which was called: # once (42µs+4µs) by Foswiki::Users::finish at line 164 of /var/www/foswikidev/core/lib/Foswiki/Users.pm
sub finish {
1581900ns my $this = shift;
15917µs undef $this->{U2L};
16011µs undef $this->{U2W};
1611900ns undef $this->{L2P};
1621700ns undef $this->{U2E};
16314µs undef $this->{L2U};
16414µs undef $this->{W2U};
16512µs undef $this->{GROUPS};
166119µs14µs $this->SUPER::finish();
# spent 4µs making 1 call to Foswiki::UserMapping::finish
167}
168
169=begin TML
170
171---++ ObjectMethod loginTemplateName () -> templateFile
172
173allows UserMappings to come with customised login screens - that should preffereably only over-ride the UI function
174
175=cut
176
177sub loginTemplateName {
178 return 'login.sudo';
179}
180
181=begin TML
182
183---++ ObjectMethod handlesUser ( $cUID, $login, $wikiname) -> $boolean
184
185See baseclass for documentation.
186
187In the BaseUserMapping case, we know all
188the details of the users we specialise in.
189
190=cut
191
192
# spent 2.61ms within Foswiki::Users::BaseUserMapping::handlesUser which was called 1077 times, avg 2µs/call: # 1069 times (2.59ms+0s) by Foswiki::Users::TopicUserMapping::_cacheUser at line 1595 of /var/www/foswikidev/core/lib/Foswiki/Users/TopicUserMapping.pm, avg 2µs/call # 8 times (26µs+0s) by Foswiki::Users::_getMapping at line 212 of /var/www/foswikidev/core/lib/Foswiki/Users.pm, avg 3µs/call
sub handlesUser {
1931077444µs my ( $this, $cUID, $login, $wikiname ) = @_;
194
1951077164µs return 1 if ( defined($cUID) && defined( $this->{U2L}{$cUID} ) );
1961074544µs return 1 if ( defined($login) && defined( $this->{L2U}{$login} ) );
1971068383µs return 1 if ( defined($wikiname) && defined( $this->{W2U}{$wikiname} ) );
198
19910672.38ms return 0;
200}
201
202=begin TML
203
204---++ ObjectMethod login2cUID ($login) -> $cUID
205
206Convert a login name to the corresponding canonical user name. The
207canonical name can be any string of 7-bit alphanumeric and underscore
208characters, and must correspond 1:1 to the login name.
209(undef on failure)
210
211=cut
212
213
# spent 4µs within Foswiki::Users::BaseUserMapping::login2cUID which was called 2 times, avg 2µs/call: # 2 times (4µs+0s) by Foswiki::Users::getCanonicalUserID at line 480 of /var/www/foswikidev/core/lib/Foswiki/Users.pm, avg 2µs/call
sub login2cUID {
21421µs my ( $this, $login ) = @_;
215
21627µs return $this->{L2U}{$login};
217
218 #alternative impl - slower, but more re-useable
219 #my @list = findUserByWikiName($this, $login);
220 #return shift @list;
221}
222
223=begin TML
224
225---++ ObjectMethod getLoginName ($cUID) -> login
226
227converts an internal cUID to that user's login
228(undef on failure)
229
230=cut
231
232
# spent 3µs within Foswiki::Users::BaseUserMapping::getLoginName which was called: # once (3µs+0s) by Foswiki::Users::getLoginName at line 685 of /var/www/foswikidev/core/lib/Foswiki/Users.pm
sub getLoginName {
2331900ns my ( $this, $user ) = @_;
23414µs return $this->{U2L}{$user};
235}
236
237=begin TML
238
239---++ ObjectMethod getWikiName ($cUID) -> wikiname
240
241Map a canonical user name to a wikiname
242
243=cut
244
245
# spent 3µs within Foswiki::Users::BaseUserMapping::getWikiName which was called: # once (3µs+0s) by Foswiki::Users::getWikiName at line 716 of /var/www/foswikidev/core/lib/Foswiki/Users.pm
sub getWikiName {
2461700ns my ( $this, $cUID ) = @_;
24714µs return $this->{U2W}->{$cUID} || getLoginName( $this, $cUID );
248}
249
250=begin TML
251
252---++ ObjectMethod userExists( $user ) -> $boolean
253
254Determine if the user already exists or not.
255
256=cut
257
258sub userExists {
259 my ( $this, $cUID ) = @_;
260 ASSERT($cUID) if DEBUG;
261 return 0 unless defined $cUID;
262 return $this->{U2L}{$cUID};
263}
264
265=begin TML
266
267---++ ObjectMethod eachUser () -> listIterator of cUIDs
268
269See baseclass for documentation.
270
271=cut
272
273sub eachUser {
274 my ($this) = @_;
275
276 my @list = keys( %{ $this->{U2W} } );
277 require Foswiki::ListIterator;
278 return new Foswiki::ListIterator( \@list );
279}
280
281=begin TML
282
283---++ ObjectMethod eachGroupMember ($group) -> listIterator of cUIDs
284
285See baseclass for documentation.
286
287The basemapper implementation assumes that there are no nested groups in the
288basemapper.
289
290=cut
291
292
# spent 24µs (12+13) within Foswiki::Users::BaseUserMapping::eachGroupMember which was called: # once (12µs+13µs) by Foswiki::UserMapping::isInGroup at line 426 of /var/www/foswikidev/core/lib/Foswiki/UserMapping.pm
sub eachGroupMember {
2931500ns my $this = shift;
2941600ns my $group = shift;
295
29611µs my $members = $this->{GROUPS}{$group};
297
298 #print STDERR "eachGroupMember($group): ".join(',', @{$members});
299
30011µs require Foswiki::ListIterator;
30117µs113µs return new Foswiki::ListIterator($members);
# spent 13µs making 1 call to Foswiki::ListIterator::new
302}
303
304=begin TML
305
306---++ ObjectMethod isGroup ($name) -> boolean
307
308See baseclass for documentation.
309
310=cut
311
312
# spent 120µs within Foswiki::Users::BaseUserMapping::isGroup which was called 62 times, avg 2µs/call: # 62 times (120µs+0s) by Foswiki::Users::isGroup at line 845 of /var/www/foswikidev/core/lib/Foswiki/Users.pm, avg 2µs/call
sub isGroup {
3136228µs my ( $this, $name ) = @_;
314626µs $name ||= "";
315
316 #TODO: what happens to the code if we implement this using an iterator too?
31762152µs return ( $this->{GROUPS}->{$name} );
318}
319
320=begin TML
321
322---++ ObjectMethod eachGroup () -> ListIterator of groupnames
323
324See baseclass for documentation.
325
326=cut
327
328sub eachGroup {
329 my ($this) = @_;
330 my @groups = keys( %{ $this->{GROUPS} } );
331
332 require Foswiki::ListIterator;
333 return new Foswiki::ListIterator( \@groups );
334}
335
336=begin TML
337
338---++ ObjectMethod eachMembership ($cUID) -> ListIterator of groups this user is in
339
340See baseclass for documentation.
341
342=cut
343
344sub eachMembership {
345 my ( $this, $cUID ) = @_;
346
347 my $it = $this->eachGroup();
348 $it->{filter} = sub {
349 $this->isInGroup( $cUID, $_[0] );
350 };
351 return $it;
352}
353
354=begin TML
355
356---++ ObjectMethod groupAllowsChange($group) -> boolean
357
358returns 0 if the group is 'owned by the BaseMapper and it wants to veto adding to that group
359
360=cut
361
362sub groupAllowsChange {
363 my $this = shift;
364 my $group = shift;
365 ASSERT( defined $group ) if DEBUG;
366
367 return 0
368 if ( ( $group eq 'BaseGroup' )
369 or ( $group eq 'RegistrationGroup' ) );
370 return 1;
371}
372
373=begin TML
374
375---++ ObjectMethod isAdmin( $cUID ) -> $boolean
376
377True if the user is an admin
378 * is a member of the $Foswiki::cfg{SuperAdminGroup}
379
380=cut
381
382
# spent 84µs (11+73) within Foswiki::Users::BaseUserMapping::isAdmin which was called: # once (11µs+73µs) by Foswiki::Users::isAdmin at line 627 of /var/www/foswikidev/core/lib/Foswiki/Users.pm
sub isAdmin {
3831800ns my ( $this, $cUID ) = @_;
384110µs173µs return $this->isInGroup( $cUID, $Foswiki::cfg{SuperAdminGroup} );
# spent 73µs making 1 call to Foswiki::UserMapping::isInGroup
385}
386
387=begin TML
388
389---++ ObjectMethod getEmails($name) -> @emailAddress
390
391If $name is a cUID, return their email addresses. If it is a group,
392return the addresses of everyone in the group.
393
394=cut
395
396sub getEmails {
397 my ( $this, $user ) = @_;
398
399 return $this->{U2E}{$user} || ();
400}
401
402=begin TML
403
404---++ ObjectMethod findUserByWikiName ($wikiname) -> list of cUIDs associated with that wikiname
405
406See baseclass for documentation.
407
408=cut
409
410sub findUserByWikiName {
411 my ( $this, $wn ) = @_;
412 my @users = ();
413
414 if ( $this->isGroup($wn) ) {
415 push( @users, $wn );
416 }
417 else {
418
419 # Add additional mappings defined in WikiUsers
420 if ( $this->{W2U}->{$wn} ) {
421 push( @users, $this->{W2U}->{$wn} );
422 }
423 elsif ( $this->{L2U}->{$wn} ) {
424
425 # The wikiname is also a login name for the purposes of this
426 # mapping. We have to do this because Foswiki defines access controls
427 # in terms of mapped users, and if a wikiname is *missing* from the
428 # mapping there is "no such user".
429 push( @users, $this->{L2U}->{$wn} );
430 }
431 }
432 return \@users;
433}
434
435=begin TML
436
437---++ ObjectMethod checkPassword( $login, $passwordU ) -> $boolean
438
439Finds if the password is valid for the given user.
440
441Returns 1 on success, undef on failure.
442
443=cut
444
445sub checkPassword {
446 my ( $this, $login, $pass ) = @_;
447
448 my $hash = $this->{L2P}->{$login};
449
450 # All of the digest / hash routines require bytes
451 $pass = Encode::encode_utf8($pass);
452
453 if ($hash) {
454 if ( length($hash) == 13 ) {
455 return 1 if ( crypt( $pass, $hash ) eq $hash );
456 }
457 elsif ( length($hash) == 42 ) {
458 my $salt = substr( $hash, 0, 10 );
459 return 1
460 if ( $salt . Digest::MD5::md5_hex( $salt . $pass ) eq $hash );
461 }
462 else {
463 my $salt = substr( $hash, 0, 14 );
464 return 1
465 if (
466 Crypt::PasswdMD5::apache_md5_crypt( $pass, $salt ) eq $hash );
467 }
468 }
469
470 # be a little more helpful to the admin
471 if ( $login eq $Foswiki::cfg{AdminUserLogin} && !$hash ) {
472 $this->{error} =
473 'To login as ' . $login . ', you must set {Password} in configure.';
474 }
475 return 0;
476}
477
478=begin TML
479
480---++ ObjectMethod setPassword( $cUID, $newPassU, $oldPassU ) -> $boolean
481
482If the $oldPassU matches matches the user's password, then it will
483replace it with $newPassU.
484
485If $oldPassU is not correct and not 1, will return 0.
486
487If $oldPassU is 1, will force the change irrespective of
488the existing password, adding the user if necessary.
489
490Otherwise returns 1 on success, undef on failure.
491
492=cut
493
494sub setPassword {
495 my ( $this, $cUID, $newPassU, $oldPassU ) = @_;
496 throw Error::Simple(
497 'cannot change user passwords using Foswiki::BaseUserMapping');
498}
499
500=begin TML
501
502---++ ObjectMethod passwordError( ) -> $string
503
504returns a string indicating the error that happened in the password handlers
505TODO: these delayed error's should be replaced with Exceptions.
506
507returns undef if no error
508
509=cut
510
511sub passwordError {
512 my $this = shift;
513
514 return $this->{error};
515}
516
51714µs1;
518__END__