2 FS::UID - Subroutines for database login and assorted other
6 use FS::UID qw(adminsuidsetup cgisuidsetup dbh datasrc getotaker
7 checkeuid checkruid swapuid);
12 $dbh = cgisuidsetup($cgi);
19 Provides a hodgepodge of subroutines.
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).
30 cgisuidsetup CGI_object
31 Stores the CGI (see the CGI manpage) object for later use.
32 (CGI::Base is depriciated) Runs adminsuidsetup.
34 cgi Returns the CGI (see the CGI manpage) object.
36 dbh Returns the DBI database handle.
39 Returns the DBI data source.
42 Returns the current Freeside user.
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.
50 Returns true if effective UID is that of the freeside user.
53 Returns true if the real UID is that of the freeside user.
56 Swaps real and effective UIDs.
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.
64 Warning: this interface is likely to change in future releases.
66 A package can install a callback to be run in adminsuidsetup by
67 putting a coderef into the hash %FS::UID::callback :
69 $coderef = sub { warn "Hi, I'm returning your call!" };
70 $FS::UID::callback{'Package::Name'};
73 Too many package-global variables.
77 No capabilities yet. When mod_perl and Authen::DBI are
78 implemented, cgisuidsetup will go away as well.
80 Goes through contortions to support non-OO syntax with multiple
83 Callbacks are inelegant.
86 the FS::Record manpage, the CGI manpage, the DBI manpage,
87 config.html from the base documentation.
90 ivan@voicenet.com 97-jun-4 - 9 untaint otaker ivan@voicenet.com
93 generalize and auto-get uid (getotaker still needs to be db'ed)
94 ivan@sisd.com 97-nov-10
96 &cgisuidsetup logs into database. other cleaning. ivan@sisd.com
99 &adminsuidsetup logs into database with otaker='freeside' (for
100 automated tasks like billing) ivan@sisd.com 97-dec-13
102 added sub datasrc for fs-setup ivan@sisd.com 98-feb-21
104 datasrc, user and pass now come from conf/secrets ivan@sisd.com
107 added ChopBlanks to DBI call (see man DBI) ivan@sisd.com 98-aug-
110 pod, use FS::Conf, implemented cgisuidsetup as adminsuidsetup,
111 inlined suidsetup ivan@sisd.com 98-sep-12
114 Revision 1.2 1998-11-13 09:56:37 ivan
115 change configuration file layout to support multiple distinct databases (with
116 own set of config files, export, etc.)
117 Revision 1.3 1998/11/08 10:45:42 ivan got sub
120 Revision 1.2 1998/11/08 09:38:43 ivan cgisuidsetup complains if
121 you pass it a isa CGI::Base instead of an isa CGI (first step in
122 migrating from CGI-modules to CGI.pm)