(file) Return to NoPasswdUser.pm CVS log (file) (dir) Up to [RizwankCVS] / geekymedia_web / twiki / lib / TWiki / User

  1 rizwank 1.1 # Module of TWiki Collaboration Platform, http://TWiki.org/
  2             #
  3             # Copyright (C) 1999-2004 Peter Thoeny, peter@thoeny.com
  4             #
  5             # For licensing info read license.txt file in the TWiki root.
  6             # This program is free software; you can redistribute it and/or
  7             # modify it under the terms of the GNU General Public License
  8             # as published by the Free Software Foundation; either version 2
  9             # of the License, or (at your option) any later version.
 10             #
 11             # This program is distributed in the hope that it will be useful,
 12             # but WITHOUT ANY WARRANTY; without even the implied warranty of
 13             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 14             # GNU General Public License for more details, published at 
 15             # http://www.gnu.org/copyleft/gpl.html
 16             #
 17             # Notes:
 18             # - Latest version at http://twiki.org/
 19             # - Installation instructions in $dataDir/Main/TWikiDocumentation.txt
 20             # - Customize variables in TWiki.cfg when installing TWiki.
 21             # - Optionally change TWiki.pm for custom extensions of rendering rules.
 22 rizwank 1.1 # - Upgrading TWiki is easy as long as you do not customize TWiki.pm.
 23             # - Check web server error logs for errors, i.e. % tail /var/log/httpd/error_log
 24             #
 25             
 26             =begin twiki
 27             
 28             ---+ TWiki::User::NoPasswdUser Package
 29             
 30             The NoPasswdUser module is an implementation of the User Authentication code that has no passwords / users
 31             
 32                * currently it is implemented to always succeed (so anyone can be anyone they like)
 33                   * which is how users os the UserCookiePlugin often work
 34                   
 35             __Note:___ this _is_ untested
 36             
 37             =cut
 38             
 39             package TWiki::User::NoPasswdUser;
 40             
 41             use strict;
 42             
 43 rizwank 1.1 # 'Use locale' for internationalisation of Perl sorting in getTopicNames
 44             # and other routines - main locale settings are done in TWiki::setupLocale
 45             BEGIN {
 46                 # Do a dynamic 'use locale' for this module
 47                 if( $TWiki::useLocale ) {
 48                     require locale;
 49             	import locale ();
 50                 }
 51             }
 52             
 53             # FIXME: Move elsewhere?
 54             # template variable hash: (built from %TMPL:DEF{"key"}% ... %TMPL:END%)
 55             use vars qw( %templateVars ); # init in TWiki.pm so okay for modPerl
 56             
 57             # ======================
 58             sub new
 59             {
 60                my( $proto ) = @_;
 61                my $class = ref($proto) || $proto;
 62                my $self = {};
 63                bless( $self, $class );
 64 rizwank 1.1 #   $self->_init();
 65             #   $self->{head} = 0;
 66                return $self;
 67             }
 68             
 69             # ===========================
 70             sub writeDebug
 71             {
 72             #   TWiki::writeDebug( "User: $_[0]" );
 73             }
 74              
 75             #========================= 
 76             =pod
 77             
 78             ---+++ UserPasswordExists( $user ) ==> $passwordExists
 79             | Description: | checks to see if there is a $user in the password system |
 80             | Parameter: =$user= | the username we are looking for  |
 81             | Return: =$passwordExists= | "" as there is no password in NoPasswdUser (this allows the registration script (and others) register new users) |
 82             
 83             =cut
 84             sub UserPasswordExists
 85 rizwank 1.1 {
 86                 my ( $self, $user ) = @_;
 87             
 88                 return "";
 89             }
 90              
 91             #========================= 
 92             =pod
 93             
 94             ---+++ UpdateUserPassword( $user, $oldUserPassword, $newUserPassword ) ==> $success
 95             | Description: | used to change the user's password |
 96             | Parameter: =$user= | the username we are replacing  |
 97             | Parameter: =$oldUserPassword= | unencrypted password |
 98             | Parameter: =$newUserPassword= | unencrypted password |
 99             | Return: =$success= | "1" always |
100             
101             =cut
102             # TODO: needs to fail if it doesw not succed due to file permissions
103             sub UpdateUserPassword
104             {
105                 my ( $self, $user, $oldUserPassword, $newUserPassword ) = @_;
106 rizwank 1.1 
107                 return "1";
108             }
109             
110             #===========================
111             =pod
112             
113             ---+++ AddUserPassword( $user, $newUserPassword ) ==> $success
114             | Description: | creates a new user & password entry |
115             | Parameter: =$user= | the username we are replacing  |
116             | Parameter: =$newUserPassword= | unencrypted password |
117             | Return: =$success= | "1" if success |
118             | TODO: | not sure if this should be true / false |
119             
120             =cut
121             sub AddUserPassword
122             {
123                 my ( $self, $user, $newUserPassword ) = @_;
124                 my $userEntry = $user.":". _htpasswdGeneratePasswd( $user, $newUserPassword , 0);
125             
126             	return "1";
127 rizwank 1.1 }
128             
129             #===========================
130             =pod
131             
132             ---+++ RemoveUser( $user ) ==> $success
133             | Description: | used to remove the user from the password system |
134             | Parameter: =$user= | the username we are replacing  |
135             | Return: =$success= | "1" if success |
136             
137             =cut
138             #i'm a wimp - comment out the password entry
139             sub RemoveUser
140             {
141                 my ( $self, $user ) = @_;
142             
143                 return "1";
144             }
145             
146             # =========================
147             =pod
148 rizwank 1.1 
149             ---+++ CheckUserPasswd( $user, $password ) ==> $success
150             | Description: | used to check the user's password |
151             | Parameter: =$user= | the username we are replacing  |
152             | Parameter: =$password= | unencrypted password |
153             | Return: =$success= | "1" if success |
154             
155             =cut
156             sub CheckUserPasswd
157             {
158                 my ( $self, $user, $password ) = @_;
159             
160                 # OK
161                 return "1";
162             }
163              
164             1;
165             
166             # EOF

Rizwan Kassim
Powered by
ViewCVS 0.9.2