9c4da492be25903a74048b24e97bde3421223bde
[freeside.git] / htdocs / docs / man / FS / UID.html
1 <HTML>
2 <HEAD>
3 <TITLE>FS::UID - Subroutines for database login and assorted other stuff</TITLE>
4 <LINK REV="made" HREF="mailto:perl@packages.debian.org">
5 </HEAD>
6
7 <BODY>
8
9 <A NAME="__index__"></A>
10 <!-- INDEX BEGIN -->
11
12 <UL>
13
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>
22 </UL>
23 <!-- INDEX END -->
24
25 <HR>
26 <P>
27 <H1><A NAME="name">NAME</A></H1>
28 <P>FS::UID - Subroutines for database login and assorted other stuff</P>
29 <P>
30 <HR>
31 <H1><A NAME="synopsis">SYNOPSIS</A></H1>
32 <PRE>
33   use FS::UID qw(adminsuidsetup cgisuidsetup dbh datasrc getotaker
34   checkeuid checkruid swapuid);</PRE>
35 <PRE>
36   adminsuidsetup $user;</PRE>
37 <PRE>
38   $cgi = new CGI;
39   $dbh = cgisuidsetup($cgi);</PRE>
40 <PRE>
41   $dbh = dbh;</PRE>
42 <PRE>
43   $datasrc = datasrc;</PRE>
44 <PRE>
45   $driver_name = driver_name;</PRE>
46 <P>
47 <HR>
48 <H1><A NAME="description">DESCRIPTION</A></H1>
49 <P>Provides a hodgepodge of subroutines.</P>
50 <P>
51 <HR>
52 <H1><A NAME="subroutines">SUBROUTINES</A></H1>
53 <DL>
54 <DT><STRONG><A NAME="item_adminsuidsetup">adminsuidsetup USER</A></STRONG><BR>
55 <DD>
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).
63 <P></P>
64 <DT><STRONG><A NAME="item_cgisuidsetup_CGI_object">cgisuidsetup CGI_object</A></STRONG><BR>
65 <DD>
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.
68 <P></P>
69 <DT><STRONG><A NAME="item_cgi">cgi</A></STRONG><BR>
70 <DD>
71 Returns the CGI (see <A HREF=".././FS/CGI.html">the CGI manpage</A>) object.
72 <P></P>
73 <DT><STRONG><A NAME="item_dbh">dbh</A></STRONG><BR>
74 <DD>
75 Returns the DBI database handle.
76 <P></P>
77 <DT><STRONG><A NAME="item_datasrc">datasrc</A></STRONG><BR>
78 <DD>
79 Returns the DBI data source.
80 <P></P>
81 <DT><STRONG><A NAME="item_driver_name">driver_name</A></STRONG><BR>
82 <DD>
83 Returns just the driver name portion of the DBI data source.
84 <P></P>
85 <DT><STRONG><A NAME="item_getotaker">getotaker</A></STRONG><BR>
86 <DD>
87 Returns the current Freeside user.
88 <P></P>
89 <DT><STRONG><A NAME="item_cgisetotaker">cgisetotaker</A></STRONG><BR>
90 <DD>
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.
94 <P></P>
95 <DT><STRONG><A NAME="item_checkeuid">checkeuid</A></STRONG><BR>
96 <DD>
97 Returns true if effective UID is that of the freeside user.
98 <P></P>
99 <DT><STRONG><A NAME="item_checkruid">checkruid</A></STRONG><BR>
100 <DD>
101 Returns true if the real UID is that of the freeside user.
102 <P></P>
103 <DT><STRONG><A NAME="item_swapuid">swapuid</A></STRONG><BR>
104 <DD>
105 Swaps real and effective UIDs.
106 <P></P>
107 <DT><STRONG><A NAME="item_getsecrets_%5B_USER_%5D">getsecrets [ USER ]</A></STRONG><BR>
108 <DD>
109 Sets the user to USER, if supplied.
110 Sets and returns the DBI datasource, username and password for this user from
111 the `/usr/local/etc/freeside/mapsecrets' file.
112 <P></P></DL>
113 <P>
114 <HR>
115 <H1><A NAME="callbacks">CALLBACKS</A></H1>
116 <P>Warning: this interface is likely to change in future releases.</P>
117 <P>A package can install a callback to be run in adminsuidsetup by putting a
118 coderef into the hash %FS::UID::callback :</P>
119 <PRE>
120     $coderef = sub { warn &quot;Hi, I'm returning your call!&quot; };
121     $FS::UID::callback{'Package::Name'};</PRE>
122 <P>
123 <HR>
124 <H1><A NAME="version">VERSION</A></H1>
125 <P>$Id: UID.html,v 1.3 2001-04-23 12:40:30 ivan Exp $</P>
126 <P>
127 <HR>
128 <H1><A NAME="bugs">BUGS</A></H1>
129 <P>Too many package-global variables.</P>
130 <P>Not OO.</P>
131 <P>No capabilities yet.  When mod_perl and Authen::DBI are implemented, 
132 cgisuidsetup will go away as well.</P>
133 <P>Goes through contortions to support non-OO syntax with multiple datasrc's.</P>
134 <P>Callbacks are inelegant.</P>
135 <P>
136 <HR>
137 <H1><A NAME="see also">SEE ALSO</A></H1>
138 <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>
139
140 </BODY>
141
142 </HTML>