34444623a837c98b6c252d284bc064328c5dcee0
[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:ivan@rootwood.sisd.com">
5 </HEAD>
6
7 <BODY>
8
9 <!-- INDEX BEGIN -->
10
11 <UL>
12
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>
21 </UL>
22 <!-- INDEX END -->
23
24 <HR>
25 <P>
26 <H1><A NAME="NAME">NAME</A></H1>
27 <P>
28 FS::UID - Subroutines for database login and assorted other stuff
29
30 <P>
31 <HR>
32 <H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
33 <P>
34 <PRE>  use FS::UID qw(adminsuidsetup cgisuidsetup dbh datasrc getotaker
35   checkeuid checkruid swapuid);
36 </PRE>
37 <P>
38 <PRE>  adminsuidsetup $user;
39 </PRE>
40 <P>
41 <PRE>  $cgi = new CGI;
42   $dbh = cgisuidsetup($cgi);
43 </PRE>
44 <P>
45 <PRE>  $dbh = dbh;
46 </PRE>
47 <P>
48 <PRE>  $datasrc = datasrc;
49 </PRE>
50 <P>
51 <HR>
52 <H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
53 <P>
54 Provides a hodgepodge of subroutines. 
55
56 <P>
57 <HR>
58 <H1><A NAME="SUBROUTINES">SUBROUTINES</A></H1>
59 <DL>
60 <DT><STRONG><A NAME="item_adminsuidsetup">adminsuidsetup USER</A></STRONG><DD>
61 <P>
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).
67
68 <DT><STRONG><A NAME="item_cgisuidsetup">cgisuidsetup CGI_object</A></STRONG><DD>
69 <P>
70 Stores the CGI (see <A HREF=".././FS/CGI.html#">the CGI manpage</A>) object for later use. (CGI::Base is depriciated) Runs adminsuidsetup.
71
72 <DT><STRONG><A NAME="item_cgi">cgi</A></STRONG><DD>
73 <P>
74 Returns the CGI (see <A HREF=".././FS/CGI.html#">the CGI manpage</A>) object.
75
76 <DT><STRONG><A NAME="item_dbh">dbh</A></STRONG><DD>
77 <P>
78 Returns the DBI database handle.
79
80 <DT><STRONG><A NAME="item_datasrc">datasrc</A></STRONG><DD>
81 <P>
82 Returns the DBI data source.
83
84 <DT><STRONG><A NAME="item_getotaker">getotaker</A></STRONG><DD>
85 <P>
86 Returns the current Freeside user.
87
88 <DT><STRONG><A NAME="item_cgisetotaker">cgisetotaker</A></STRONG><DD>
89 <P>
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
92 depriciated.
93
94 <DT><STRONG><A NAME="item_checkeuid">checkeuid</A></STRONG><DD>
95 <P>
96 Returns true if effective UID is that of the freeside user.
97
98 <DT><STRONG><A NAME="item_checkruid">checkruid</A></STRONG><DD>
99 <P>
100 Returns true if the real UID is that of the freeside user.
101
102 <DT><STRONG><A NAME="item_swapuid">swapuid</A></STRONG><DD>
103 <P>
104 Swaps real and effective UIDs.
105
106 <DT><STRONG><A NAME="item_getsecrets">getsecrets [ USER ]</A></STRONG><DD>
107 <P>
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.
111
112 </DL>
113 <P>
114 <HR>
115 <H1><A NAME="CALLBACKS">CALLBACKS</A></H1>
116 <P>
117 Warning: this interface is likely to change in future releases.
118
119 <P>
120 A package can install a callback to be run in adminsuidsetup by putting a
121 coderef into the hash %FS::UID::callback :
122
123 <P>
124 <PRE>    $coderef = sub { warn &quot;Hi, I'm returning your call!&quot; };
125     $FS::UID::callback{'Package::Name'};
126 </PRE>
127 <P>
128 <HR>
129 <H1><A NAME="VERSION">VERSION</A></H1>
130 <P>
131 $Id: UID.html,v 1.1 1999-08-04 12:13:27 ivan Exp $
132
133 <P>
134 <HR>
135 <H1><A NAME="BUGS">BUGS</A></H1>
136 <P>
137 Too many package-global variables.
138
139 <P>
140 Not OO.
141
142 <P>
143 No capabilities yet. When mod_perl and Authen::DBI are implemented,
144 cgisuidsetup will go away as well.
145
146 <P>
147 Goes through contortions to support non-OO syntax with multiple datasrc's.
148
149 <P>
150 Callbacks are inelegant.
151
152 <P>
153 <HR>
154 <H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
155 <P>
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.
157
158 </BODY>
159
160 </HTML>