regenerated perl api docs from embedded pod
[freeside.git] / htdocs / docs / man / UID.txt
1 NAME
2     FS::UID - Subroutines for database login and assorted other
3     stuff
4
5 SYNOPSIS
6       use FS::UID qw(adminsuidsetup cgisuidsetup dbh datasrc getotaker
7       checkeuid checkruid swapuid);
8
9       adminsuidsetup $user;
10
11       $cgi = new CGI;
12       $dbh = cgisuidsetup($cgi);
13
14       $dbh = dbh;
15
16       $datasrc = datasrc;
17
18 DESCRIPTION
19     Provides a hodgepodge of subroutines.
20
21 SUBROUTINES
22     adminsuidsetup USER
23         Sets the user to USER (see config.html from the base
24         documentation). Cleans the environment. Make sure the script
25         is running as freeside, or setuid freeside. Opens a
26         connection to the database. Swaps real and effective UIDs.
27         Runs any defined callbacks (see below). Returns the DBI
28         database handle (usually you don't need this).
29
30     cgisuidsetup CGI_object
31         Stores the CGI (see the CGI manpage) object for later use.
32         (CGI::Base is depriciated) Runs adminsuidsetup.
33
34     cgi Returns the CGI (see the CGI manpage) object.
35
36     dbh Returns the DBI database handle.
37
38     datasrc
39         Returns the DBI data source.
40
41     getotaker
42         Returns the current Freeside user.
43
44     cgisetotaker
45         Sets and returns the CGI REMOTE_USER. $cgi should be defined
46         as a CGI.pm object. Support for CGI::Base and derived
47         classes is depriciated.
48
49     checkeuid
50         Returns true if effective UID is that of the freeside user.
51
52     checkruid
53         Returns true if the real UID is that of the freeside user.
54
55     swapuid
56         Swaps real and effective UIDs.
57
58     getsecrets [ USER ]
59         Sets the user to USER, if supplied. Sets and returns the DBI
60         datasource, username and password for this user from the
61         `/usr/local/etc/freeside/mapsecrets' file.
62
63 CALLBACKS
64     Warning: this interface is likely to change in future releases.
65
66     A package can install a callback to be run in adminsuidsetup by
67     putting a coderef into the hash %FS::UID::callback :
68
69         $coderef = sub { warn "Hi, I'm returning your call!" };
70         $FS::UID::callback{'Package::Name'};
71
72 VERSION
73     $Id: UID.txt,v 1.3 1999-02-09 09:37:52 ivan Exp $
74
75 BUGS
76     Too many package-global variables.
77
78     Not OO.
79
80     No capabilities yet. When mod_perl and Authen::DBI are
81     implemented, cgisuidsetup will go away as well.
82
83     Goes through contortions to support non-OO syntax with multiple
84     datasrc's.
85
86     Callbacks are inelegant.
87
88 SEE ALSO
89     the FS::Record manpage, the CGI manpage, the DBI manpage,
90     config.html from the base documentation.
91
92 HISTORY
93     ivan@voicenet.com 97-jun-4 - 9 untaint otaker ivan@voicenet.com
94     97-jul-7
95
96     generalize and auto-get uid (getotaker still needs to be db'ed)
97     ivan@sisd.com 97-nov-10
98
99     &cgisuidsetup logs into database. other cleaning. ivan@sisd.com
100     97-nov-22,23
101
102     &adminsuidsetup logs into database with otaker='freeside' (for
103     automated tasks like billing) ivan@sisd.com 97-dec-13
104
105     added sub datasrc for fs-setup ivan@sisd.com 98-feb-21
106
107     datasrc, user and pass now come from conf/secrets ivan@sisd.com
108     98-jun-28
109
110     added ChopBlanks to DBI call (see man DBI) ivan@sisd.com 98-aug-
111     16
112
113     pod, use FS::Conf, implemented cgisuidsetup as adminsuidsetup,
114     inlined suidsetup ivan@sisd.com 98-sep-12
115
116     $Log: UID.txt,v $
117     Revision 1.3  1999-02-09 09:37:52  ivan
118     regenerated perl api docs from embedded pod
119  Revision 1.7 1999/01/18 09:22:40 ivan changes
120     to track email addresses for email invoicing
121
122     Revision 1.6 1998/11/15 05:27:48 ivan bugfix for new
123     configuration layout
124
125     Revision 1.5 1998/11/15 00:51:51 ivan eliminated some warnings
126     on certain fatal errors (well, it is less confusing)
127
128     Revision 1.4 1998/11/13 09:56:52 ivan change configuration file
129     layout to support multiple distinct databases (with own set of
130     config files, export, etc.)
131
132     Revision 1.3 1998/11/08 10:45:42 ivan got sub cgi for FS::CGI
133
134     Revision 1.2 1998/11/08 09:38:43 ivan cgisuidsetup complains if
135     you pass it a isa CGI::Base instead of an isa CGI (first step in
136     migrating from CGI-modules to CGI.pm)
137