f27c1d65353a665c6007196c124f9a5aabd623d6
[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 = new FS::svc_acct \%hash;
8       $record = new 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::svc_Common. 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     new 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 VERSION
130     $Id: svc_acct.txt,v 1.3 1999-02-09 09:38:11 ivan Exp $
131
132 BUGS
133     The remote commands should be configurable.
134
135     The bits which ssh should fork before doing so.
136
137     The $recref stuff in sub check should be cleaned up.
138
139 SEE ALSO
140     the FS::svc_Common manpage, the FS::Record manpage, the FS::Conf
141     manpage, the FS::cust_svc manpage, the FS::part_svc manpage, the
142     FS::cust_pkg manpage, the FS::SSH manpage, the ssh manpage, the
143     FS::svc_acct_pop manpage, schema.html from the base
144     documentation.
145
146 HISTORY
147     ivan@voicenet.com 97-jul-16 - 21
148
149     rewrite (among other things, now know about part_svc)
150     ivan@sisd.com 98-mar-8
151
152     Changed 'password' to '_password' because Pg6.3 reserves the
153     password word bmccane@maxbaud.net 98-apr-3
154
155     username length and shell no longer hardcoded ivan@sisd.com 98-
156     jun-28
157
158     eww but needed: ignore uid duplicates for 'fax' and 'hylafax'
159     ivan@sisd.com 98-jun-29
160
161     $nossh_hack ivan@sisd.com 98-jul-13
162
163     protections against UID/GID of 0 for incorrectly-setup RDBMSs
164     (also in bin/svc_acct.export) ivan@sisd.com 98-jul-13
165
166     arbitrary radius attributes ivan@sisd.com 98-aug-13
167
168     /var/spool/freeside/conf/shellmachine ivan@sisd.com 98-aug-13
169
170     pod and FS::conf ivan@sisd.com 98-sep-22
171
172     $Log: svc_acct.txt,v $
173     Revision 1.3  1999-02-09 09:38:11  ivan
174     regenerated perl api docs from embedded pod
175  Revision 1.6 1999/01/25 12:26:15 ivan yet
176     more mod_perl stuff
177
178     Revision 1.5 1999/01/18 21:58:09 ivan esthetic: eq and ne were
179     used in a few places instead of == and !=
180
181     Revision 1.4 1998/12/30 00:30:45 ivan svc_ stuff is more
182     properly OO - has a common superclass FS::svc_Common
183
184     Revision 1.2 1998/11/13 09:56:55 ivan change configuration file
185     layout to support multiple distinct databases (with own set of
186     config files, export, etc.)
187