summaryrefslogtreecommitdiff
path: root/htdocs/docs/man/FS/UID.html
blob: cad23d59d985d1f9caaf23ddb5d6b798ab1d1b07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<HTML>
<HEAD>
<TITLE>FS::UID - Subroutines for database login and assorted other stuff</TITLE>
<LINK REV="made" HREF="mailto:none">
</HEAD>

<BODY>

<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#NAME">NAME</A>
	<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
	<LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
	<LI><A HREF="#SUBROUTINES">SUBROUTINES</A>
	<LI><A HREF="#CALLBACKS">CALLBACKS</A>
	<LI><A HREF="#VERSION">VERSION</A>
	<LI><A HREF="#BUGS">BUGS</A>
	<LI><A HREF="#SEE_ALSO">SEE ALSO</A>
</UL>
<!-- INDEX END -->

<HR>
<P>
<H1><A NAME="NAME">NAME</A></H1>
<P>
FS::UID - Subroutines for database login and assorted other stuff

<P>
<HR>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<P>
<PRE>  use FS::UID qw(adminsuidsetup cgisuidsetup dbh datasrc getotaker
  checkeuid checkruid swapuid);
</PRE>
<P>
<PRE>  adminsuidsetup $user;
</PRE>
<P>
<PRE>  $cgi = new CGI;
  $dbh = cgisuidsetup($cgi);
</PRE>
<P>
<PRE>  $dbh = dbh;
</PRE>
<P>
<PRE>  $datasrc = datasrc;
</PRE>
<P>
<HR>
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
<P>
Provides a hodgepodge of subroutines. 

<P>
<HR>
<H1><A NAME="SUBROUTINES">SUBROUTINES</A></H1>
<DL>
<DT><STRONG><A NAME="item_adminsuidsetup">adminsuidsetup USER</A></STRONG><DD>
<P>
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).

<DT><STRONG><A NAME="item_cgisuidsetup">cgisuidsetup CGI_object</A></STRONG><DD>
<P>
Stores the CGI (see <A HREF=".././FS/CGI.html#">the CGI manpage</A>) object for later use. (CGI::Base is depriciated) Runs adminsuidsetup.

<DT><STRONG><A NAME="item_cgi">cgi</A></STRONG><DD>
<P>
Returns the CGI (see <A HREF=".././FS/CGI.html#">the CGI manpage</A>) object.

<DT><STRONG><A NAME="item_dbh">dbh</A></STRONG><DD>
<P>
Returns the DBI database handle.

<DT><STRONG><A NAME="item_datasrc">datasrc</A></STRONG><DD>
<P>
Returns the DBI data source.

<DT><STRONG><A NAME="item_getotaker">getotaker</A></STRONG><DD>
<P>
Returns the current Freeside user.

<DT><STRONG><A NAME="item_cgisetotaker">cgisetotaker</A></STRONG><DD>
<P>
Sets and returns the CGI REMOTE_USER. <A HREF="#item__cgi">$cgi</A> should
be defined as a CGI.pm object. Support for CGI::Base and derived classes is
depriciated.

<DT><STRONG><A NAME="item_checkeuid">checkeuid</A></STRONG><DD>
<P>
Returns true if effective UID is that of the freeside user.

<DT><STRONG><A NAME="item_checkruid">checkruid</A></STRONG><DD>
<P>
Returns true if the real UID is that of the freeside user.

<DT><STRONG><A NAME="item_swapuid">swapuid</A></STRONG><DD>
<P>
Swaps real and effective UIDs.

<DT><STRONG><A NAME="item_getsecrets">getsecrets [ USER ]</A></STRONG><DD>
<P>
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.

</DL>
<P>
<HR>
<H1><A NAME="CALLBACKS">CALLBACKS</A></H1>
<P>
Warning: this interface is likely to change in future releases.

<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.2 2000-03-03 18:22:42 ivan Exp $

<P>
<HR>
<H1><A NAME="BUGS">BUGS</A></H1>
<P>
Too many package-global variables.

<P>
Not OO.

<P>
No capabilities yet. When mod_perl and Authen::DBI are implemented,
cgisuidsetup will go away as well.

<P>
Goes through contortions to support non-OO syntax with multiple datasrc's.

<P>
Callbacks are inelegant.

<P>
<HR>
<H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
<P>
<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.

</BODY>

</HTML>