3 <TITLE>FS::UID - Subroutines for database login and assorted other stuff</TITLE>
4 <LINK REV="made" HREF="mailto:none">
13 <LI><A HREF="#NAME">NAME</A>
14 <LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
15 <LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
16 <LI><A HREF="#SUBROUTINES">SUBROUTINES</A>
17 <LI><A HREF="#CALLBACKS">CALLBACKS</A>
18 <LI><A HREF="#VERSION">VERSION</A>
19 <LI><A HREF="#BUGS">BUGS</A>
20 <LI><A HREF="#SEE_ALSO">SEE ALSO</A>
26 <H1><A NAME="NAME">NAME</A></H1>
28 FS::UID - Subroutines for database login and assorted other stuff
32 <H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
34 <PRE> use FS::UID qw(adminsuidsetup cgisuidsetup dbh datasrc getotaker
35 checkeuid checkruid swapuid);
38 <PRE> adminsuidsetup $user;
42 $dbh = cgisuidsetup($cgi);
48 <PRE> $datasrc = datasrc;
52 <H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
54 Provides a hodgepodge of subroutines.
58 <H1><A NAME="SUBROUTINES">SUBROUTINES</A></H1>
60 <DT><STRONG><A NAME="item_adminsuidsetup">adminsuidsetup USER</A></STRONG><DD>
62 Sets the user to USER (see config.html from the base documentation). Cleans
63 the environment. Make sure the script is running as freeside, or setuid
64 freeside. Opens a connection to the database. Swaps real and effective
65 UIDs. Runs any defined callbacks (see below). Returns the DBI database
66 handle (usually you don't need this).
68 <DT><STRONG><A NAME="item_cgisuidsetup">cgisuidsetup CGI_object</A></STRONG><DD>
70 Stores the CGI (see <A HREF=".././FS/CGI.html#">the CGI manpage</A>) object for later use. (CGI::Base is depriciated) Runs adminsuidsetup.
72 <DT><STRONG><A NAME="item_cgi">cgi</A></STRONG><DD>
74 Returns the CGI (see <A HREF=".././FS/CGI.html#">the CGI manpage</A>) object.
76 <DT><STRONG><A NAME="item_dbh">dbh</A></STRONG><DD>
78 Returns the DBI database handle.
80 <DT><STRONG><A NAME="item_datasrc">datasrc</A></STRONG><DD>
82 Returns the DBI data source.
84 <DT><STRONG><A NAME="item_getotaker">getotaker</A></STRONG><DD>
86 Returns the current Freeside user.
88 <DT><STRONG><A NAME="item_cgisetotaker">cgisetotaker</A></STRONG><DD>
90 Sets and returns the CGI REMOTE_USER. <A HREF="#item__cgi">$cgi</A> should
91 be defined as a CGI.pm object. Support for CGI::Base and derived classes is
94 <DT><STRONG><A NAME="item_checkeuid">checkeuid</A></STRONG><DD>
96 Returns true if effective UID is that of the freeside user.
98 <DT><STRONG><A NAME="item_checkruid">checkruid</A></STRONG><DD>
100 Returns true if the real UID is that of the freeside user.
102 <DT><STRONG><A NAME="item_swapuid">swapuid</A></STRONG><DD>
104 Swaps real and effective UIDs.
106 <DT><STRONG><A NAME="item_getsecrets">getsecrets [ USER ]</A></STRONG><DD>
108 Sets the user to USER, if supplied. Sets and returns the DBI datasource,
109 username and password for this user from the
110 `/usr/local/etc/freeside/mapsecrets' file.
115 <H1><A NAME="CALLBACKS">CALLBACKS</A></H1>
117 Warning: this interface is likely to change in future releases.
120 A package can install a callback to be run in adminsuidsetup by putting a
121 coderef into the hash %FS::UID::callback :
124 <PRE> $coderef = sub { warn "Hi, I'm returning your call!" };
125 $FS::UID::callback{'Package::Name'};
129 <H1><A NAME="VERSION">VERSION</A></H1>
131 $Id: UID.html,v 1.2 2000-03-03 18:22:42 ivan Exp $
135 <H1><A NAME="BUGS">BUGS</A></H1>
137 Too many package-global variables.
143 No capabilities yet. When mod_perl and Authen::DBI are implemented,
144 cgisuidsetup will go away as well.
147 Goes through contortions to support non-OO syntax with multiple datasrc's.
150 Callbacks are inelegant.
154 <H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
156 <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.