summaryrefslogtreecommitdiff
path: root/httemplate/docs/man/FS/UID.html
blob: 3c28eebfd22278b13d0687fa9b55c55aed3ae639 (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
<HTML>
<HEAD>
<TITLE>FS::UID - Subroutines for database login and assorted other stuff</TITLE>
<LINK REV="made" HREF="mailto:perl@packages.debian.org">
</HEAD>

<BODY>

<A NAME="__index__"></A>
<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#name">NAME</A></LI>
	<LI><A HREF="#synopsis">SYNOPSIS</A></LI>
	<LI><A HREF="#description">DESCRIPTION</A></LI>
	<LI><A HREF="#subroutines">SUBROUTINES</A></LI>
	<LI><A HREF="#callbacks">CALLBACKS</A></LI>
	<LI><A HREF="#version">VERSION</A></LI>
	<LI><A HREF="#bugs">BUGS</A></LI>
	<LI><A HREF="#see also">SEE ALSO</A></LI>
</UL>
<!-- INDEX END -->

<HR>
<P>
<H1><A NAME="name">NAME</A></H1>
<P>FS::UID - Subroutines for database login and assorted other stuff</P>
<P>
<HR>
<H1><A NAME="synopsis">SYNOPSIS</A></H1>
<PRE>
  use FS::UID qw(adminsuidsetup cgisuidsetup dbh datasrc getotaker
  checkeuid checkruid);</PRE>
<PRE>
  adminsuidsetup $user;</PRE>
<PRE>
  $cgi = new CGI;
  $dbh = cgisuidsetup($cgi);</PRE>
<PRE>
  $dbh = dbh;</PRE>
<PRE>
  $datasrc = datasrc;</PRE>
<PRE>
  $driver_name = driver_name;</PRE>
<P>
<HR>
<H1><A NAME="description">DESCRIPTION</A></H1>
<P>Provides a hodgepodge of subroutines.</P>
<P>
<HR>
<H1><A NAME="subroutines">SUBROUTINES</A></H1>
<DL>
<DT><STRONG><A NAME="item_adminsuidsetup">adminsuidsetup USER</A></STRONG><BR>
<DD>
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).
<P></P>
<DT><STRONG><A NAME="item_cgisuidsetup_CGI_object">cgisuidsetup CGI_object</A></STRONG><BR>
<DD>
Takes a single argument, which is a CGI (see <A HREF=".././FS/CGI.html">the CGI manpage</A>) or Apache (see <EM>Apache</EM>)
object (CGI::Base is depriciated).  Runs cgisetotaker and then adminsuidsetup.
<P></P>
<DT><STRONG><A NAME="item_cgi">cgi</A></STRONG><BR>
<DD>
Returns the CGI (see <A HREF=".././FS/CGI.html">the CGI manpage</A>) object.
<P></P>
<DT><STRONG><A NAME="item_dbh">dbh</A></STRONG><BR>
<DD>
Returns the DBI database handle.
<P></P>
<DT><STRONG><A NAME="item_datasrc">datasrc</A></STRONG><BR>
<DD>
Returns the DBI data source.
<P></P>
<DT><STRONG><A NAME="item_driver_name">driver_name</A></STRONG><BR>
<DD>
Returns just the driver name portion of the DBI data source.
<P></P>
<DT><STRONG><A NAME="item_getotaker">getotaker</A></STRONG><BR>
<DD>
Returns the current Freeside user.
<P></P>
<DT><STRONG><A NAME="item_cgisetotaker">cgisetotaker</A></STRONG><BR>
<DD>
Sets and returns the CGI REMOTE_USER.  $cgi should be defined as a CGI.pm
object (see <A HREF=".././FS/CGI.html">the CGI manpage</A>) or an Apache object (see <EM>Apache</EM>).  Support for CGI::Base
and derived classes is depriciated.
<P></P>
<DT><STRONG><A NAME="item_checkeuid">checkeuid</A></STRONG><BR>
<DD>
Returns true if effective UID is that of the freeside user.
<P></P>
<DT><STRONG><A NAME="item_checkruid">checkruid</A></STRONG><BR>
<DD>
Returns true if the real UID is that of the freeside user.
<P></P>
<DT><STRONG><A NAME="item_getsecrets_%5B_USER_%5D">getsecrets [ USER ]</A></STRONG><BR>
<DD>
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.
<P></P></DL>
<P>
<HR>
<H1><A NAME="callbacks">CALLBACKS</A></H1>
<P>Warning: this interface is likely to change in future releases.</P>
<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.3 2002-01-29 17:42:46 ivan Exp $</P>
<P>
<HR>
<H1><A NAME="bugs">BUGS</A></H1>
<P>Too many package-global variables.</P>
<P>Not OO.</P>
<P>No capabilities yet.  When mod_perl and Authen::DBI are implemented, 
cgisuidsetup will go away as well.</P>
<P>Goes through contortions to support non-OO syntax with multiple datasrc's.</P>
<P>Callbacks are inelegant.</P>
<P>
<HR>
<H1><A NAME="see also">SEE ALSO</A></H1>
<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>

</BODY>

</HTML>