3 <TITLE>FS::UID - Subroutines for database login and assorted other stuff</TITLE>
4 <LINK REV="made" HREF="mailto:perl@packages.debian.org">
9 <A NAME="__index__"></A>
14 <LI><A HREF="#name">NAME</A></LI>
15 <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
16 <LI><A HREF="#description">DESCRIPTION</A></LI>
17 <LI><A HREF="#subroutines">SUBROUTINES</A></LI>
18 <LI><A HREF="#callbacks">CALLBACKS</A></LI>
19 <LI><A HREF="#version">VERSION</A></LI>
20 <LI><A HREF="#bugs">BUGS</A></LI>
21 <LI><A HREF="#see also">SEE ALSO</A></LI>
27 <H1><A NAME="name">NAME</A></H1>
28 <P>FS::UID - Subroutines for database login and assorted other stuff</P>
31 <H1><A NAME="synopsis">SYNOPSIS</A></H1>
33 use FS::UID qw(adminsuidsetup cgisuidsetup dbh datasrc getotaker
34 checkeuid checkruid);</PRE>
36 adminsuidsetup $user;</PRE>
39 $dbh = cgisuidsetup($cgi);</PRE>
43 $datasrc = datasrc;</PRE>
45 $driver_name = driver_name;</PRE>
48 <H1><A NAME="description">DESCRIPTION</A></H1>
49 <P>Provides a hodgepodge of subroutines.</P>
52 <H1><A NAME="subroutines">SUBROUTINES</A></H1>
54 <DT><STRONG><A NAME="item_adminsuidsetup">adminsuidsetup USER</A></STRONG><BR>
56 Sets the user to USER (see config.html from the base documentation).
57 Cleans the environment.
58 Make sure the script is running as freeside, or setuid freeside.
59 Opens a connection to the database.
60 Swaps real and effective UIDs.
61 Runs any defined callbacks (see below).
62 Returns the DBI database handle (usually you don't need this).
64 <DT><STRONG><A NAME="item_cgisuidsetup_CGI_object">cgisuidsetup CGI_object</A></STRONG><BR>
66 Takes a single argument, which is a CGI (see <A HREF=".././FS/CGI.html">the CGI manpage</A>) or Apache (see <EM>Apache</EM>)
67 object (CGI::Base is depriciated). Runs cgisetotaker and then adminsuidsetup.
69 <DT><STRONG><A NAME="item_cgi">cgi</A></STRONG><BR>
71 Returns the CGI (see <A HREF=".././FS/CGI.html">the CGI manpage</A>) object.
73 <DT><STRONG><A NAME="item_dbh">dbh</A></STRONG><BR>
75 Returns the DBI database handle.
77 <DT><STRONG><A NAME="item_datasrc">datasrc</A></STRONG><BR>
79 Returns the DBI data source.
81 <DT><STRONG><A NAME="item_driver_name">driver_name</A></STRONG><BR>
83 Returns just the driver name portion of the DBI data source.
85 <DT><STRONG><A NAME="item_getotaker">getotaker</A></STRONG><BR>
87 Returns the current Freeside user.
89 <DT><STRONG><A NAME="item_cgisetotaker">cgisetotaker</A></STRONG><BR>
91 Sets and returns the CGI REMOTE_USER. $cgi should be defined as a CGI.pm
92 object (see <A HREF=".././FS/CGI.html">the CGI manpage</A>) or an Apache object (see <EM>Apache</EM>). Support for CGI::Base
93 and derived classes is depriciated.
95 <DT><STRONG><A NAME="item_checkeuid">checkeuid</A></STRONG><BR>
97 Returns true if effective UID is that of the freeside user.
99 <DT><STRONG><A NAME="item_checkruid">checkruid</A></STRONG><BR>
101 Returns true if the real UID is that of the freeside user.
103 <DT><STRONG><A NAME="item_getsecrets_%5B_USER_%5D">getsecrets [ USER ]</A></STRONG><BR>
105 Sets the user to USER, if supplied.
106 Sets and returns the DBI datasource, username and password for this user from
107 the `/usr/local/etc/freeside/mapsecrets' file.
111 <H1><A NAME="callbacks">CALLBACKS</A></H1>
112 <P>Warning: this interface is likely to change in future releases.</P>
113 <P>A package can install a callback to be run in adminsuidsetup by putting a
114 coderef into the hash %FS::UID::callback :</P>
116 $coderef = sub { warn "Hi, I'm returning your call!" };
117 $FS::UID::callback{'Package::Name'};</PRE>
120 <H1><A NAME="version">VERSION</A></H1>
121 <P>$Id: UID.html,v 1.3 2002-01-29 17:42:46 ivan Exp $</P>
124 <H1><A NAME="bugs">BUGS</A></H1>
125 <P>Too many package-global variables.</P>
127 <P>No capabilities yet. When mod_perl and Authen::DBI are implemented,
128 cgisuidsetup will go away as well.</P>
129 <P>Goes through contortions to support non-OO syntax with multiple datasrc's.</P>
130 <P>Callbacks are inelegant.</P>
133 <H1><A NAME="see also">SEE ALSO</A></H1>
134 <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>