CGI-Builder-Auth
view release on metacpan or search on metacpan
lib/CGI/Builder/Auth/UserAdmin.pm view on Meta::CPAN
Returns the encrypted password for a user
$passwd = $user->password("dougm");
Useful for copying users to another database.
=item fetch($username,@fields)
Fetch a list of field values from the indicated user. Field names may
be provided as a list or as an array reference. The return value is a
reference to a hash containing the field/value pairs.
=item list()
Returns a list of usernames in the current database
@users = $user->list
=item update($username,$password)
=item update($username,$password,\%fields) B<SQL only>
Update $username with a new $password
if($user->update('dougm', 'idunno')) {
print "Updated\n";
}
With SQL servers, you can update other fields in the table by passing
a hash reference:
$user->update('dougm','idunno',{'credit_limit'=>1000});
An undefined value in the password field will leave the field unchanged.
=item group()
Short cut for creating an CGI::Builder::Auth::GroupAdmin object.
All applicable attributes are inherited, but can be
overridden.
$group = $user->group(NAME => 'www-group');
(See CGI::Builder::Auth::GroupAdmin)
=item convert(@Attributes)
Convert a database.
$dbmuser = $user->convert(@Apache);
=item lock([$timeout])
=item unlock()
These methods give you control of the locking mechanism.
$user = new CGI::Builder::Auth::UserAdmin (Locking => 0); #turn off auto-locking
$user->lock; #lock the object's database
$user->add($username,$passwd); #write while file is locked
$user->unlock; release the lock
=item db($dbname);
Select a different database.
$olddb = $user->db($newdb);
print "Now we're reading and writing '$newdb', done with '$olddb'n\";
=item flags([$flags])
Get or set read, write, create flags.
=item commit
Commit changes to disk (for Text files).
=back
=head1 Message Digest User Databases
Currently, you can store user info in a format for servers who support
Message Digest Authentication. Here's an example:
$user = new CGI::Builder::Auth::UserAdmin (DB => '.htdigest', Encrypt => 'MD5');
($username,$realm,$password) = ('JoeUser', 'SomePlace', '14me');
#The checksum contains more info that just a password
$user->add($username, "$username:$realm:$password");
$user->update($username, "$username:$realm:newone");
$info = $user->password($username);
($realm, $checksum) = split(":", $info);
$user->delete($username);
See <URL:http://hoohoo.ncsa.uiuc.edu/docs/howto/md5_auth.html> for NCSA's
implementation.
So, it's a little more work, but don't worry, a nicer interface is on the way.
=head1 SEE ALSO
CGI::Builder::Auth::GroupAdmin(3), CGI::Builder::Auth::Authen(3)
=head1 AUTHOR
Doug MacEachern <dougm@osf.org>
Copyright (c) 1996, Doug MacEachern
This library is free software;
you can redistribute it and/or modify it under the same terms as Perl itself.
=cut
( run in 1.552 second using v1.01-cache-2.11-cpan-39bf76dae61 )