← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/local/src/github.com/foswiki/core/bin/view
  Run on Sun Dec 4 17:17:59 2011
Reported on Sun Dec 4 17:26:45 2011

Filename/usr/local/src/github.com/foswiki/core/lib/Foswiki/Users/Password.pm
StatementsExecuted 14 statements in 897µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11125µs32µsFoswiki::Users::Password::::BEGIN@17Foswiki::Users::Password::BEGIN@17
11122µs39µsFoswiki::Users::Password::::BEGIN@18Foswiki::Users::Password::BEGIN@18
11122µs22µsFoswiki::Users::Password::::newFoswiki::Users::Password::new
11118µs18µsFoswiki::Users::Password::::finishFoswiki::Users::Password::finish
11118µs64µsFoswiki::Users::Password::::BEGIN@19Foswiki::Users::Password::BEGIN@19
0000s0sFoswiki::Users::Password::::canFetchUsersFoswiki::Users::Password::canFetchUsers
0000s0sFoswiki::Users::Password::::checkPasswordFoswiki::Users::Password::checkPassword
0000s0sFoswiki::Users::Password::::encryptFoswiki::Users::Password::encrypt
0000s0sFoswiki::Users::Password::::errorFoswiki::Users::Password::error
0000s0sFoswiki::Users::Password::::fetchPassFoswiki::Users::Password::fetchPass
0000s0sFoswiki::Users::Password::::fetchUsersFoswiki::Users::Password::fetchUsers
0000s0sFoswiki::Users::Password::::findUserByEmailFoswiki::Users::Password::findUserByEmail
0000s0sFoswiki::Users::Password::::getEmailsFoswiki::Users::Password::getEmails
0000s0sFoswiki::Users::Password::::isManagingEmailsFoswiki::Users::Password::isManagingEmails
0000s0sFoswiki::Users::Password::::readOnlyFoswiki::Users::Password::readOnly
0000s0sFoswiki::Users::Password::::removeUserFoswiki::Users::Password::removeUser
0000s0sFoswiki::Users::Password::::setEmailsFoswiki::Users::Password::setEmails
0000s0sFoswiki::Users::Password::::setPasswordFoswiki::Users::Password::setPassword
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::Password
6
7Base class of all password handlers. Default behaviour is no passwords,
8so anyone can be anyone they like.
9
10The methods of this class should be overridded by subclasses that want
11to implement other password handling methods.
12
13=cut
14
15package Foswiki::Users::Password;
16
17245µs239µs
# spent 32µs (25+7) within Foswiki::Users::Password::BEGIN@17 which was called: # once (25µs+7µs) by Foswiki::Users::HtPasswdUser::BEGIN@18 at line 17
use strict;
# spent 32µs making 1 call to Foswiki::Users::Password::BEGIN@17 # spent 7µs making 1 call to strict::import
18244µs256µs
# spent 39µs (22+17) within Foswiki::Users::Password::BEGIN@18 which was called: # once (22µs+17µs) by Foswiki::Users::HtPasswdUser::BEGIN@18 at line 18
use warnings;
# spent 39µs making 1 call to Foswiki::Users::Password::BEGIN@18 # spent 17µs making 1 call to warnings::import
192757µs2111µs
# spent 64µs (18+47) within Foswiki::Users::Password::BEGIN@19 which was called: # once (18µs+47µs) by Foswiki::Users::HtPasswdUser::BEGIN@18 at line 19
use Assert;
# spent 64µs making 1 call to Foswiki::Users::Password::BEGIN@19 # spent 46µs making 1 call to Assert::import
20
21=begin TML
22
23---++ ClassMethod new( $session ) -> $object
24
25Constructs a new password handler of this type, referring to $session
26for any required Foswiki services.
27
28=cut
29
30
# spent 22µs within Foswiki::Users::Password::new which was called: # once (22µs+0s) by Foswiki::Users::HtPasswdUser::new at line 41 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Users/HtPasswdUser.pm
sub new {
31428µs my ( $class, $session ) = @_;
32
33 my $this = bless( { session => $session }, $class );
34 $this->{error} = undef;
35 return $this;
36}
37
38=begin TML
39
40---++ ObjectMethod finish()
41Break circular references.
42
43=cut
44
45# Note to developers; please undef *all* fields in the object explicitly,
46# whether they are references or not. That way this method is "golden
47# documentation" of the live fields in the object.
48
# spent 18µs within Foswiki::Users::Password::finish which was called: # once (18µs+0s) by Foswiki::Users::HtPasswdUser::finish at line 106 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Users/HtPasswdUser.pm
sub finish {
49320µs my $this = shift;
50 undef $this->{error};
51 undef $this->{session};
52}
53
54=begin TML
55
56---++ ObjectMethod readOnly( ) -> boolean
57
58returns true if the password database is not currently modifyable
59also needs to call
60$this->{session}->enter_context('passwords_modifyable');
61if you want to be able to use the existing TopicUserMappingContrib ChangePassword topics
62
63=cut
64
65sub readOnly {
66 return 1; #there _is_ no password file.
67}
68
69=begin TML
70
71---++ ObjectMethod fetchPass( $login ) -> $passwordE
72
73Implements Foswiki::Password
74
75Returns encrypted password if succeeds.
76Returns 0 if login is invalid.
77Returns undef otherwise.
78
79=cut
80
81sub fetchPass {
82 return;
83}
84
85=begin TML
86
87---++ ObjectMethod checkPassword( $login, $passwordU ) -> $boolean
88
89Finds if the password is valid for the given user.
90
91Returns 1 on success, undef on failure.
92
93=cut
94
95sub checkPassword {
96 my $this = shift;
97 $this->{error} = undef;
98 return 1;
99}
100
101=begin TML
102
103---++ ObjectMethod removeUser( $login ) -> $boolean
104
105Delete the users entry.
106
107=cut
108
109sub removeUser {
110 my $this = shift;
111 $this->{error} = undef;
112 return 1;
113}
114
115=begin TML
116
117---++ ObjectMethod setPassword( $login, $newPassU, $oldPassU ) -> $boolean
118
119If the $oldPassU matches matches the user's password, then it will
120replace it with $newPassU.
121
122If $oldPassU is not correct and not 1, will return 0.
123
124If $oldPassU is 1, will force the change irrespective of
125the existing password, adding the user if necessary.
126
127Otherwise returns 1 on success, undef on failure.
128
129=cut
130
131sub setPassword {
132 my $this = shift;
133 $this->{error} = 'System does not support changing passwords';
134 return 1;
135}
136
137=begin TML
138
139---++ encrypt( $login, $passwordU, $fresh ) -> $passwordE
140
141Will return an encrypted password. Repeated calls
142to encrypt with the same login/passU will return the same passE.
143
144However if the passU is changed, and subsequently changed _back_
145to the old login/passU pair, then the old passE is no longer valid.
146
147If $fresh is true, then a new password not based on any pre-existing
148salt will be used. Set this if you are generating a completely
149new password.
150
151=cut
152
153sub encrypt {
154 return '';
155}
156
157=begin TML
158
159---++ ObjectMethod error() -> $string
160
161Return any error raised by the last method call, or undef if the last
162method call succeeded.
163
164=cut
165
166sub error {
167 my $this = shift;
168
169 return $this->{error};
170}
171
172=begin TML
173
174---++ ObjectMethod isManagingEmails() -> $boolean
175Determines if this manager can store and retrieve emails. The password
176manager is used in preference to the user mapping manager for storing
177emails, on the basis that emails need to be secure, and the password
178database is the most secure place. If a password manager does not
179manage emails, then Foswiki will fall back to using the user mapping
180manager (which by default will store emails in user topics)
181
182The default ('none') password manager does *not* manage emails.
183
184=cut
185
186sub isManagingEmails {
187 return 0;
188}
189
190=begin TML
191
192---++ ObjectMethod getEmails($login) -> @emails
193Fetch the email address(es) for the given login. Default
194behaviour is to return an empty list. Called by Users.pm.
195Only used if =isManagingEmails= -> =true=.
196
197=cut
198
199sub getEmails {
200 ASSERT( 0, "should never be called" ) if DEBUG;
201}
202
203=begin TML
204
205---++ ObjectMethod setEmails($login, @emails) -> $boolean
206Set the email address(es) for the given login name. Returns true if
207the emails were set successfully.
208Default behaviour is a nop, which will result in the user mapping manager
209taking over. Called by Users.pm.
210Only used if =isManagingEmails= -> =true=.
211
212=cut
213
214sub setEmails {
215 ASSERT( 0, "should never be called" ) if DEBUG;
216}
217
218=begin TML
219
220---++ ObjectMethod findUserByEmail($email) -> \@users
221Returns an array of login names that relate to a email address.
222Defaut behaviour is a nop, which will result in the user mapping manager
223being asked for its opinion. If subclass implementations return a value for
224this, then the user mapping manager will *not* be asked.
225Only used if =isManagingEmails= -> =true=.
226
227Called by Users.pm.
228
229=cut
230
231sub findUserByEmail {
232 ASSERT( 0, "should never be called" ) if DEBUG;
233}
234
235=begin TML
236
237---++ ObjectMethod canFetchUsers() -> boolean
238
239returns true if the fetchUsers method is implemented and can return an iterator of users.
240returns undef / nothing in this case, as we are unable to generate a list of users
241
242=cut
243
244sub canFetchUsers {
245 return;
246}
247
248=begin TML
249
250---++ ObjectMethod fetchUsers() -> $iterator
251
252returns an Iterator of loginnames from the password source. If AllowLoginNames is false
253this is used to remove the need for a WikiUsers topic.
254
255=cut
256
257sub fetchUsers {
258
259 die "not Implemented in Base class";
260
261 #return new Foswiki::ListIterator(\@users);
262}
263
26414µs1;
265__END__