@node HTTPD/GroupAdmin, HTTPD/UserAdmin, HTTPD/Authen, Module List
@unnumbered Management of HTTP server group databases


@unnumberedsec NAME 

HTTPD::GroupAdmin - Management of HTTP server group databases

@unnumberedsec SYNOPSIS

@example
require HTTPD::GroupAdmin
@end example

@unnumberedsec DESCRIPTION

This software is meant to provide a generic interface that
hides the inconsistencies across HTTP server implementations 
of user and group databases.

@unnumberedsec METHODS

@unnumberedsubsec new ()

Here@'s where we find out what@'s different about your server.

Some examples:

@example
@@DBM = (DBType => @'DBM@',
	    DB     => @'.htgroup@',
	    Server => @'apache@');
@end example

@example
$group = new HTTPD::GroupAdmin @@DBM;
@end example

This creates an object who@'s database is a DBM file named @'.htgroup@', in a format that 
the Apache server understands.

@example
@@Text = (DBType => @'Text@',
	     DB     => @'.htgroup@',
	     Server => @'ncsa@');
@end example

@example
$group = new HTTPD::GroupAdmin @@Text;
@end example

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

@strong{DBType}  - The type of database, one of @'DBM@', @'Text@', or @'SQL@' (Default is @'DBM@')

@strong{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:

@strong{DBMF}    - The DBM file implementation to use (Default is @'NDBM@')

Flags   - The read, write and create flags.  
There are four modes:
@strong{rwc} - the default, open for reading, writing and creating.
@strong{rw} - open for reading and writing.
@strong{r} - open for reading only.
w - open for writing only.

@strong{Mode}    - The file creation mode, defaults to @'0644@'

From here on out, things should look the same for everyone.

@unnumberedsubsec add($username[,$groupname])

Add user $username to group $groupname, or whatever the @'Name@' attribute is set to.

Fails if $username exists in the database

@example
if($group->add(@'dougm@', @'www-group@')) @{
	print "Welcome!\n";
@}
@end example

@unnumberedsubsec delete($username[,$groupname])

Delete user $username from group $groupname, or whatever the @'Name@' attribute is set to.

@example
if($group->delete(@'dougm@')) @{
	print "He@'s gone from the group\n";
@}
@end example

@unnumberedsubsec exists($groupname)

True if $groupname is found in the database

@example
if($group->exists(@'web-heads@')) @{
	die "oh no!";
@}
@end example

@unnumberedsubsec list([$groupname])

Returns a list of group names, or users in a group if @'$name@' is present.

@@groups = $group->list;

@@users = $group->list(@'web-heads@');

@unnumberedsubsec user()

Short cut for creating an HTTPD::UserAdmin object.
All applicable attributes are inherited, but can be 
overridden.

@example
$user = $group->user();
@end example

(See HTTPD::UserAdmin)

@unnumberedsubsec convert(@@Attributes)

Convert a database. 

@example
#not yet
@end example

@unnumberedsubsec remove($groupname)

Remove group $groupname from the database

@unnumberedsubsec name($groupname)

Change the value of @'Name@' attribute.

@example
$group->name(@'bew-ediw-dlrow@');
@end example

@unnumberedsubsec debug($boolean)

Turn debugging on or off

@unnumberedsubsec lock([$timeout]) =head2 unlock()

These methods give you control of the locking mechanism.

@example
$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
@end example

@unnumberedsubsec db($dbname);

Select a different database.

@example
$olddb = $group->db($newdb);
print "Now we@'re reading and writing @'$newdb@', done with @'$olddb@'n\";
@end example

@unnumberedsec SEE ALSO

HTTPD::UserAdmin

@unnumberedsec AUTHOR

Doug MacEachern <dougm@@osf.org>

Copyright (c) 1996, Doug MacEachern, OSF Research Institute

This library is free software; 
you can redistribute it and/or modify it under the same terms as Perl itself. 

