=pod =head1 NAME Schema::RDBMS::AUS - Authentication, Users and Sessions in an SQL schema =head1 SYNOPSIS $ migrate-database-schema --dsn DBI:Pg: --verbose Schema::RDBMS::AUS =head1 DESCRIPTION B I The Schema::RDBMS::AUS distribution provides a complete transactional, mid-level interface to users, groups, and sessions, including: =over =item * SQL schema defining users, sessions, groups, permissions, and a security log =item * A rich L and L =item * A L subclass (L) for session management =item * Sessions are serialized in a MySQL or PostgreSQL database, using L, a data serailization language that is easily read both by humans and most popular programming languages. =back This package only supplies an API for the management of users and sessions, it does not integrate them with any particular user interface. If you are developing a web application that needs authentication, users, and sessions, see L. Apache2::AUS provides a mod_perl2 handler over top of Schema::RDBMS::AUS that manages users and sessions, which can then be used by other mod_perl2 modules, CGI scripts, or even PHP/Ruby/Python. =head1 INSTALLING THE DATABASE SCHEMA Currently, PostgreSQL (7.4 and above) and MySQL (5.0 and above) are supported. To install the database schema, use the L utility, supplied by the L distribution. For example, the following line would install the schema into the MySQL database 'joe': $ migrate-database-schema --dsn DBI:mysql:database=joe --verbose Schema::RDBMS::AUS B For both the PostgreSQL and MySQL schemas, it's best to install them as the database superuser. =head2 PostgreSQL The entire PostgreSQL database schema can be installed by a regular database user so long as the C language is already installed in the database you wish to use. If C is I installed, Schema::RDBMS::AUS will attempt to install it for you. This requires database administrator privileges. =head2 MySQL With MySQL, you're really better off just installing the entire schema as root. The permissions system for C and C in MySQL are a bit screwed up, and if your user B have permissions to install these objects, the situation is even worse: B, meaning that a half-finished, failed schema installation can not be backed out properly. I've tried all sorts of crazy GRANT statements and have not yet successfully installed this schema as an unprivileged user and have concluded that MySQL is pretty much braindead. Once the schema is installed, it can be accessed with a regular user with no problems. =head1 MANAGING SESSIONS See L. =head1 MANAGING USERS, GROUPS, AND PERMISSIONS See L. =head1 ENVIRONMENT The following environment variables are used by Schema::RDBMS::AUS: =over =item AUS_DB_DSN =item AUS_DB_USER =item AUS_DB_PASS The L Data Source Name, Username, and Password to connect to the database with. If any of these environment variables are not specified, the DBI standard C, C, and C variables are checked as well. =item AUS_SESSION_ID If this environment variable is specified, it is used as the default session id for L. =back =head1 METHODS Most of the methods you would be interested in are probably in L or L. However, C itself provides a few class methods: =over =item dbh Returns a C database handle connected to the authentication, users, and sessions database. It accepts the same arguments as connect() in the L distribution. If any parameters are not specified, their default values are taken from the environment as described above. =item sdbh Obtains a database handle from dbh(), then asks L if our SQL schema is installed there. If it is, the database handle is returned. If not, sdbh will die() with a useful error message. =back =head1 THANKS =over =item Mischa Sandberg Mischa has taught me quite a bit about Postgres in general, and wrote the triggers and views that are used to support hierarchical user/group membership. =item Mark Stosberg Mark maintains CGI::Session, the package that made L possible. He also provided some constructive criticism in his review of Schema::RDBMS::AUS (http://cpanratings.perl.org/dist/Schema-RDBMS-AUS), and let me into the CGI::Session subversion tree so that I could implement the YAML and JSON L serializers. =back =head1 AUTHOR Tyler "Crackerjack" MacDonald =head1 LICENSE Copyright 2006 Tyler "Crackerjack" MacDonald This is free software; You may distribute it under the same terms as perl itself. =cut