<HTML> <HEAD> <TITLE>FS::UID - Subroutines for database login and assorted other stuff</TITLE> <LINK REV="made" HREF="mailto:none"> </HEAD> <BODY> <!-- INDEX BEGIN --> <UL> <LI><A HREF="#NAME">NAME</A> <LI><A HREF="#SYNOPSIS">SYNOPSIS</A> <LI><A HREF="#DESCRIPTION">DESCRIPTION</A> <LI><A HREF="#SUBROUTINES">SUBROUTINES</A> <LI><A HREF="#CALLBACKS">CALLBACKS</A> <LI><A HREF="#VERSION">VERSION</A> <LI><A HREF="#BUGS">BUGS</A> <LI><A HREF="#SEE_ALSO">SEE ALSO</A> </UL> <!-- INDEX END --> <HR> <P> <H1><A NAME="NAME">NAME</A></H1> <P> FS::UID - Subroutines for database login and assorted other stuff <P> <HR> <H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1> <P> <PRE> use FS::UID qw(adminsuidsetup cgisuidsetup dbh datasrc getotaker checkeuid checkruid swapuid); </PRE> <P> <PRE> adminsuidsetup $user; </PRE> <P> <PRE> $cgi = new CGI; $dbh = cgisuidsetup($cgi); </PRE> <P> <PRE> $dbh = dbh; </PRE> <P> <PRE> $datasrc = datasrc; </PRE> <P> <HR> <H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1> <P> Provides a hodgepodge of subroutines. <P> <HR> <H1><A NAME="SUBROUTINES">SUBROUTINES</A></H1> <DL> <DT><STRONG><A NAME="item_adminsuidsetup">adminsuidsetup USER</A></STRONG><DD> <P> Sets the user to USER (see config.html from the base documentation). Cleans the environment. Make sure the script is running as freeside, or setuid freeside. Opens a connection to the database. Swaps real and effective UIDs. Runs any defined callbacks (see below). Returns the DBI database handle (usually you don't need this). <DT><STRONG><A NAME="item_cgisuidsetup">cgisuidsetup CGI_object</A></STRONG><DD> <P> Stores the CGI (see <A HREF=".././FS/CGI.html#">the CGI manpage</A>) object for later use. (CGI::Base is depriciated) Runs adminsuidsetup. <DT><STRONG><A NAME="item_cgi">cgi</A></STRONG><DD> <P> Returns the CGI (see <A HREF=".././FS/CGI.html#">the CGI manpage</A>) object. <DT><STRONG><A NAME="item_dbh">dbh</A></STRONG><DD> <P> Returns the DBI database handle. <DT><STRONG><A NAME="item_datasrc">datasrc</A></STRONG><DD> <P> Returns the DBI data source. <DT><STRONG><A NAME="item_getotaker">getotaker</A></STRONG><DD> <P> Returns the current Freeside user. <DT><STRONG><A NAME="item_cgisetotaker">cgisetotaker</A></STRONG><DD> <P> Sets and returns the CGI REMOTE_USER. <A HREF="#item__cgi">$cgi</A> should be defined as a CGI.pm object. Support for CGI::Base and derived classes is depriciated. <DT><STRONG><A NAME="item_checkeuid">checkeuid</A></STRONG><DD> <P> Returns true if effective UID is that of the freeside user. <DT><STRONG><A NAME="item_checkruid">checkruid</A></STRONG><DD> <P> Returns true if the real UID is that of the freeside user. <DT><STRONG><A NAME="item_swapuid">swapuid</A></STRONG><DD> <P> Swaps real and effective UIDs. <DT><STRONG><A NAME="item_getsecrets">getsecrets [ USER ]</A></STRONG><DD> <P> Sets the user to USER, if supplied. Sets and returns the DBI datasource, username and password for this user from the `/usr/local/etc/freeside/mapsecrets' file. </DL> <P> <HR> <H1><A NAME="CALLBACKS">CALLBACKS</A></H1> <P> Warning: this interface is likely to change in future releases. <P> A package can install a callback to be run in adminsuidsetup by putting a coderef into the hash %FS::UID::callback : <P> <PRE> $coderef = sub { warn "Hi, I'm returning your call!" }; $FS::UID::callback{'Package::Name'}; </PRE> <P> <HR> <H1><A NAME="VERSION">VERSION</A></H1> <P> $Id: UID.html,v 1.2 2000-03-03 18:22:42 ivan Exp $ <P> <HR> <H1><A NAME="BUGS">BUGS</A></H1> <P> Too many package-global variables. <P> Not OO. <P> No capabilities yet. When mod_perl and Authen::DBI are implemented, cgisuidsetup will go away as well. <P> Goes through contortions to support non-OO syntax with multiple datasrc's. <P> Callbacks are inelegant. <P> <HR> <H1><A NAME="SEE_ALSO">SEE ALSO</A></H1> <P> <A HREF="../FS/Record.html">FS::Record</A>, <A HREF=".././FS/CGI.html#">the CGI manpage</A>, <EM>DBI</EM>, config.html from the base documentation. </BODY> </HTML>