change configuration file layout to support multiple distinct databases (with
[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 BUGS
73     Too many package-global variables.
74
75     Not OO.
76
77     No capabilities yet. When mod_perl and Authen::DBI are
78     implemented, cgisuidsetup will go away as well.
79
80     Goes through contortions to support non-OO syntax with multiple
81     datasrc's.
82
83     Callbacks are inelegant.
84
85 SEE ALSO
86     the FS::Record manpage, the CGI manpage, the DBI manpage,
87     config.html from the base documentation.
88
89 HISTORY
90     ivan@voicenet.com 97-jun-4 - 9 untaint otaker ivan@voicenet.com
91     97-jul-7
92
93     generalize and auto-get uid (getotaker still needs to be db'ed)
94     ivan@sisd.com 97-nov-10
95
96     &cgisuidsetup logs into database. other cleaning. ivan@sisd.com
97     97-nov-22,23
98
99     &adminsuidsetup logs into database with otaker='freeside' (for
100     automated tasks like billing) ivan@sisd.com 97-dec-13
101
102     added sub datasrc for fs-setup ivan@sisd.com 98-feb-21
103
104     datasrc, user and pass now come from conf/secrets ivan@sisd.com
105     98-jun-28
106
107     added ChopBlanks to DBI call (see man DBI) ivan@sisd.com 98-aug-
108     16
109
110     pod, use FS::Conf, implemented cgisuidsetup as adminsuidsetup,
111     inlined suidsetup ivan@sisd.com 98-sep-12
112
113     $Log: UID.txt,v $
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
118     cgi for FS::CGI
119
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)
123