change configuration file layout to support multiple distinct databases (with
[freeside.git] / htdocs / docs / man / svc_acct.txt
1 NAME
2     FS::svc_acct - Object methods for svc_acct records
3
4 SYNOPSIS
5       use FS::svc_acct;
6
7       $record = create FS::svc_acct \%hash;
8       $record = create FS::svc_acct { 'column' => 'value' };
9
10       $error = $record->insert;
11
12       $error = $new_record->replace($old_record);
13
14       $error = $record->delete;
15
16       $error = $record->check;
17
18       $error = $record->suspend;
19
20       $error = $record->unsuspend;
21
22       $error = $record->cancel;
23
24 DESCRIPTION
25     An FS::svc_acct object represents an account. FS::svc_acct
26     inherits from FS::Record. The following fields are currently
27     supported:
28
29     svcnum - primary key (assigned automatcially for new accounts)
30     username
31     _password - generated if blank
32     popnum - Point of presence (see the FS::svc_acct_pop manpage)
33     uid
34     gid
35     finger - GECOS
36     dir - set automatically if blank (and uid is not)
37     shell
38     quota - (unimplementd)
39     slipip - IP address
40     radius_*Radius_Attribute* - *Radius-Attribute*
41 METHODS
42     create HASHREF
43         Creates a new account. To add the account to the database,
44         see the section on "insert".
45
46     insert
47         Adds this account to the database. If there is an error,
48         returns the error, otherwise returns false.
49
50         The additional fields pkgnum and svcpart (see the
51         FS::cust_svc manpage) should be defined. An FS::cust_svc
52         record will be created and inserted.
53
54         If the configuration value (see the FS::Conf manpage)
55         shellmachine exists, and the username, uid, and dir fields
56         are defined, the command
57
58           useradd -d $dir -m -s $shell -u $uid $username
59
60         is executed on shellmachine via ssh. This behaviour can be
61         surpressed by setting $FS::svc_acct::nossh_hack true.
62
63     delete
64         Deletes this account from the database. If there is an
65         error, returns the error, otherwise returns false.
66
67         The corresponding FS::cust_svc record will be deleted as
68         well.
69
70         If the configuration value (see the FS::Conf manpage)
71         shellmachine exists, the command:
72
73           userdel $username
74
75         is executed on shellmachine via ssh. This behaviour can be
76         surpressed by setting $FS::svc_acct::nossh_hack true.
77
78     replace OLD_RECORD
79         Replaces OLD_RECORD with this one in the database. If there
80         is an error, returns the error, otherwise returns false.
81
82         If the configuration value (see the FS::Conf manpage)
83         shellmachine exists, and the dir field has changed, the
84         command:
85
86           [ -d $old_dir ] && (
87             chmod u+t $old_dir;
88             umask 022;
89             mkdir $new_dir;
90             cd $old_dir;
91             find . -depth -print | cpio -pdm $new_dir;
92             chmod u-t $new_dir;
93             chown -R $uid.$gid $new_dir;
94             rm -rf $old_dir
95           )
96
97         is executed on shellmachine via ssh. This behaviour can be
98         surpressed by setting $FS::svc_acct::nossh_hack true.
99
100     suspend
101         Suspends this account by prefixing *SUSPENDED* to the
102         password. If there is an error, returns the error, otherwise
103         returns false.
104
105         Called by the suspend method of FS::cust_pkg (see the
106         FS::cust_pkg manpage).
107
108     unsuspend
109         Unsuspends this account by removing *SUSPENDED* from the
110         password. If there is an error, returns the error, otherwise
111         returns false.
112
113         Called by the unsuspend method of FS::cust_pkg (see the
114         FS::cust_pkg manpage).
115
116     cancel
117         Just returns false (no error) for now.
118
119         Called by the cancel method of FS::cust_pkg (see the
120         FS::cust_pkg manpage).
121
122     check
123         Checks all fields to make sure this is a valid service. If
124         there is an error, returns the error, otherwise returns
125         false. Called by the insert and replace methods.
126
127         Sets any fixed values; see the FS::part_svc manpage.
128
129 BUGS
130     It doesn't properly override FS::Record yet.
131
132     The remote commands should be configurable.
133
134     The create method should set defaults from part_svc (like the
135     check method sets fixed values).
136
137 SEE ALSO
138     the FS::Record manpage, the FS::Conf manpage, the FS::cust_svc
139     manpage, the FS::part_svc manpage, the FS::cust_pkg manpage, the
140     FS::SSH manpage, the ssh manpage, the FS::svc_acct_pop manpage,
141     schema.html from the base documentation.
142
143 HISTORY
144     ivan@voicenet.com 97-jul-16 - 21
145
146     rewrite (among other things, now know about part_svc)
147     ivan@sisd.com 98-mar-8
148
149     Changed 'password' to '_password' because Pg6.3 reserves the
150     password word bmccane@maxbaud.net 98-apr-3
151
152     username length and shell no longer hardcoded ivan@sisd.com 98-
153     jun-28
154
155     eww but needed: ignore uid duplicates for 'fax' and 'hylafax'
156     ivan@sisd.com 98-jun-29
157
158     $nossh_hack ivan@sisd.com 98-jul-13
159
160     protections against UID/GID of 0 for incorrectly-setup RDBMSs
161     (also in bin/svc_acct.export) ivan@sisd.com 98-jul-13
162
163     arbitrary radius attributes ivan@sisd.com 98-aug-13
164
165     /var/spool/freeside/conf/shellmachine ivan@sisd.com 98-aug-13
166
167     pod and FS::conf ivan@sisd.com 98-sep-22
168
169     $Log: svc_acct.txt,v $
170     Revision 1.2  1998-11-13 09:56:44  ivan
171     change configuration file layout to support multiple distinct databases (with
172     own set of config files, export, etc.)
173
174