![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
use HTTPD::GroupAdmin ();
Some examples:
@DBM = (DBType => 'DBM', DB => '.htgroup', Server => 'apache');
$group = new HTTPD::GroupAdmin @DBM;
This creates an object who's database is a DBM file named '.htgroup', in a format that the Apache server understands.
@Text = (DBType => 'Text', DB => '.htgroup', Server => 'ncsa');
$group = new HTTPD::GroupAdmin @Text;
This creates an object who's database is a plain text file named '.htgroup', in a format that the NCSA server understands.
Note: Support is not yet availible for SQL servers
Full list of constructor attributes:
Note: Attribute names are case-insensitive
Name - Group name
DBType - The type of database, one of 'DBM', 'Text', or 'SQL' (Default is 'DBM')
DB - The database name (Default is '.htpasswd' for DBM & Text databases)
Server - HTTP server name (Default is the generic class, that works with NCSA, Apache and possibly others)
Note: run 'perl t/support.t matrix' to see what support is currently availible
Path - Relative DB files are resolved to this value (Default is '.')
Locking - Boolean, Lock Text and DBM files (Default is true)
Debug - Boolean, Turn on debug mode
Specific to DBM files:
DBMF - The DBM file implementation to use (Default is 'NDBM')
Flags - The read, write and create flags. There are four modes: rwc - the default, open for reading, writing and creating. rw - open for reading and writing. r - open for reading only. w - open for writing only.
Mode - The file creation mode, defaults to '0644'
From here on out, things should look the same for everyone.
$username
to group $groupname, or whatever the 'Name'
attribute is set to.
Fails if $username
exists in the database
if($group->add('dougm', 'www-group')) { print "Welcome!\n"; }
$username
from group $groupname, or whatever the
'Name' attribute is set to.
if($group->delete('dougm')) { print "He's gone from the group\n"; }
$groupname
is found in the database
if($group->exists('web-heads')) { die "oh no!"; } if($group->exists($groupname, $username) { #$username is a member of $groupname }
@groups
= $group->list;
@users
= $group->list('web-heads');
$user = $group->user();
(See HTTPD::UserAdmin)
#not yet
$groupname
from the database
$group->name('bew-ediw-dlrow');
$group = new HTTPD::GroupAdmin (Locking => 0); #turn off auto-locking $group->lock; #lock the object's database $group->add($username,$passwd); #write while database is locked $group->unlock; release the lock
$olddb = $group->db($newdb); print "Now we're reading and writing '$newdb', done with '$olddb'n\";
Copyright (c) 1996, 1997 Doug MacEachern
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
$CommentsMailTo = "perl5@dcs.ed.ac.uk"; include("../syssies_footer.inc");?>