<HTML>
<HEAD>
<TITLE>FS::UID - Subroutines for database login and assorted other stuff</TITLE>
<LINK REV="made" HREF="mailto:perl@packages.debian.org">
</HEAD>

<BODY>

<A NAME="__index__"></A>
<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#name">NAME</A></LI>
	<LI><A HREF="#synopsis">SYNOPSIS</A></LI>
	<LI><A HREF="#description">DESCRIPTION</A></LI>
	<LI><A HREF="#subroutines">SUBROUTINES</A></LI>
	<LI><A HREF="#callbacks">CALLBACKS</A></LI>
	<LI><A HREF="#version">VERSION</A></LI>
	<LI><A HREF="#bugs">BUGS</A></LI>
	<LI><A HREF="#see also">SEE ALSO</A></LI>
</UL>
<!-- INDEX END -->

<HR>
<P>
<H1><A NAME="name">NAME</A></H1>
<P>FS::UID - Subroutines for database login and assorted other stuff</P>
<P>
<HR>
<H1><A NAME="synopsis">SYNOPSIS</A></H1>
<PRE>
  use FS::UID qw(adminsuidsetup cgisuidsetup dbh datasrc getotaker
  checkeuid checkruid swapuid);</PRE>
<PRE>
  adminsuidsetup $user;</PRE>
<PRE>
  $cgi = new CGI;
  $dbh = cgisuidsetup($cgi);</PRE>
<PRE>
  $dbh = dbh;</PRE>
<PRE>
  $datasrc = datasrc;</PRE>
<PRE>
  $driver_name = driver_name;</PRE>
<P>
<HR>
<H1><A NAME="description">DESCRIPTION</A></H1>
<P>Provides a hodgepodge of subroutines.</P>
<P>
<HR>
<H1><A NAME="subroutines">SUBROUTINES</A></H1>
<DL>
<DT><STRONG><A NAME="item_adminsuidsetup">adminsuidsetup USER</A></STRONG><BR>
<DD>
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).
<P></P>
<DT><STRONG><A NAME="item_cgisuidsetup_CGI_object">cgisuidsetup CGI_object</A></STRONG><BR>
<DD>
Takes a single argument, which is a CGI (see <A HREF=".././FS/CGI.html">the CGI manpage</A>) or Apache (see <EM>Apache</EM>)
object (CGI::Base is depriciated).  Runs cgisetotaker and then adminsuidsetup.
<P></P>
<DT><STRONG><A NAME="item_cgi">cgi</A></STRONG><BR>
<DD>
Returns the CGI (see <A HREF=".././FS/CGI.html">the CGI manpage</A>) object.
<P></P>
<DT><STRONG><A NAME="item_dbh">dbh</A></STRONG><BR>
<DD>
Returns the DBI database handle.
<P></P>
<DT><STRONG><A NAME="item_datasrc">datasrc</A></STRONG><BR>
<DD>
Returns the DBI data source.
<P></P>
<DT><STRONG><A NAME="item_driver_name">driver_name</A></STRONG><BR>
<DD>
Returns just the driver name portion of the DBI data source.
<P></P>
<DT><STRONG><A NAME="item_getotaker">getotaker</A></STRONG><BR>
<DD>
Returns the current Freeside user.
<P></P>
<DT><STRONG><A NAME="item_cgisetotaker">cgisetotaker</A></STRONG><BR>
<DD>
Sets and returns the CGI REMOTE_USER.  $cgi should be defined as a CGI.pm
object (see <A HREF=".././FS/CGI.html">the CGI manpage</A>) or an Apache object (see <EM>Apache</EM>).  Support for CGI::Base
and derived classes is depriciated.
<P></P>
<DT><STRONG><A NAME="item_checkeuid">checkeuid</A></STRONG><BR>
<DD>
Returns true if effective UID is that of the freeside user.
<P></P>
<DT><STRONG><A NAME="item_checkruid">checkruid</A></STRONG><BR>
<DD>
Returns true if the real UID is that of the freeside user.
<P></P>
<DT><STRONG><A NAME="item_swapuid">swapuid</A></STRONG><BR>
<DD>
Swaps real and effective UIDs.
<P></P>
<DT><STRONG><A NAME="item_getsecrets_%5B_USER_%5D">getsecrets [ USER ]</A></STRONG><BR>
<DD>
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.
<P></P></DL>
<P>
<HR>
<H1><A NAME="callbacks">CALLBACKS</A></H1>
<P>Warning: this interface is likely to change in future releases.</P>
<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 &quot;Hi, I'm returning your call!&quot; };
    $FS::UID::callback{'Package::Name'};</PRE>
<P>
<HR>
<H1><A NAME="version">VERSION</A></H1>
<P>$Id: UID.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
<P>
<HR>
<H1><A NAME="bugs">BUGS</A></H1>
<P>Too many package-global variables.</P>
<P>Not OO.</P>
<P>No capabilities yet.  When mod_perl and Authen::DBI are implemented, 
cgisuidsetup will go away as well.</P>
<P>Goes through contortions to support non-OO syntax with multiple datasrc's.</P>
<P>Callbacks are inelegant.</P>
<P>
<HR>
<H1><A NAME="see also">SEE ALSO</A></H1>
<P><A HREF=".././FS/Record.html">the FS::Record manpage</A>, <A HREF=".././FS/CGI.html">the CGI manpage</A>, <EM>DBI</EM>, config.html from the base documentation.</P>

</BODY>

</HTML>