summaryrefslogtreecommitdiff
path: root/httemplate/docs/man/FS/svc_acct.html
blob: 9c41db3f0eb84aa23ac254ed84147559dc887343 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<HTML>
<HEAD>
<TITLE>FS::svc_acct - Object methods for svc_acct records</TITLE>
<LINK REV="made" HREF="mailto:perl@packages.debian.org">
</HEAD>

<BODY>

<A NAME="__index__"></A>
<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#name">NAME</A></LI>
	<LI><A HREF="#synopsis">SYNOPSIS</A></LI>
	<LI><A HREF="#description">DESCRIPTION</A></LI>
	<LI><A HREF="#methods">METHODS</A></LI>
	<LI><A HREF="#version">VERSION</A></LI>
	<LI><A HREF="#bugs">BUGS</A></LI>
	<LI><A HREF="#see also">SEE ALSO</A></LI>
</UL>
<!-- INDEX END -->

<HR>
<P>
<H1><A NAME="name">NAME</A></H1>
<P>FS::svc_acct - Object methods for svc_acct records</P>
<P>
<HR>
<H1><A NAME="synopsis">SYNOPSIS</A></H1>
<PRE>
  use FS::svc_acct;</PRE>
<PRE>
  $record = new FS::svc_acct \%hash;
  $record = new FS::svc_acct { 'column' =&gt; 'value' };</PRE>
<PRE>
  $error = $record-&gt;insert;</PRE>
<PRE>
  $error = $new_record-&gt;replace($old_record);</PRE>
<PRE>
  $error = $record-&gt;delete;</PRE>
<PRE>
  $error = $record-&gt;check;</PRE>
<PRE>
  $error = $record-&gt;suspend;</PRE>
<PRE>
  $error = $record-&gt;unsuspend;</PRE>
<PRE>
  $error = $record-&gt;cancel;</PRE>
<PRE>
  %hash = $record-&gt;radius;</PRE>
<PRE>
  %hash = $record-&gt;radius_reply;</PRE>
<PRE>
  %hash = $record-&gt;radius_check;</PRE>
<PRE>
  $domain = $record-&gt;domain;</PRE>
<PRE>
  $svc_domain = $record-&gt;svc_domain;</PRE>
<PRE>
  $email = $record-&gt;email;</PRE>
<PRE>
  $seconds_since = $record-&gt;seconds_since($timestamp);</PRE>
<P>
<HR>
<H1><A NAME="description">DESCRIPTION</A></H1>
<P>An FS::svc_acct object represents an account.  FS::svc_acct inherits from
FS::svc_Common.  The following fields are currently supported:</P>
<DL>
<DT><STRONG><A NAME="item_key">svcnum - primary key (assigned automatcially for new accounts)</A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item_username">username</A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item__password_%2D_generated_if_blank">_password - generated if blank</A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item_presence">popnum - Point of presence (see <A HREF=".././FS/svc_acct_pop.html">the FS::svc_acct_pop manpage</A>)</A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item_uid">uid</A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item_gid">gid</A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item_finger_%2D_GECOS">finger - GECOS</A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item_blank">dir - set automatically if blank (and uid is not)</A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item_shell">shell</A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item_quota_%2D_%28unimplementd%29">quota - (unimplementd)</A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item_slipip_%2D_IP_address">slipip - IP address</A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item_seconds_%2D">seconds -</A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item_domsvc_%2D_svcnum_from_svc_domain">domsvc - svcnum from svc_domain</A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item_radius_Radius_Attribute_%2D_Radius%2DAttribute">radius_<EM>Radius_Attribute</EM> - <EM>Radius-Attribute</EM></A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item_domsvc_%2D_service_number_of_svc_domain_with_which">domsvc - service number of svc_domain with which to associate</A></STRONG><BR>
<DD>
</DL>
<P>
<HR>
<H1><A NAME="methods">METHODS</A></H1>
<DL>
<DT><STRONG><A NAME="item_new">new HASHREF</A></STRONG><BR>
<DD>
Creates a new account.  To add the account to the database, see <A HREF="#insert">insert</A>.
<P></P>
<DT><STRONG><A NAME="item_insert">insert</A></STRONG><BR>
<DD>
Adds this account to the database.  If there is an error, returns the error,
otherwise returns false.
<P>The additional fields pkgnum and svcpart (see <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>) should be 
defined.  An FS::cust_svc record will be created and inserted.</P>
<P>If the configuration value (see <A HREF=".././FS/Conf.html">the FS::Conf manpage</A>) shellmachine exists, and the 
username, uid, and dir fields are defined, the <CODE>command(s)</CODE> specified in
the shellmachine-useradd configuration are added to the job queue (see
<A HREF=".././FS/queue.html">the FS::queue manpage</A> and <A HREF=".././bin/freeside-queued.html">the freeside-queued manpage</A>) to be exectued on shellmachine via ssh.
This behaviour can be surpressed by setting $FS::svc_acct::nossh_hack true.
If the shellmachine-useradd configuration file does not exist,</P>
<PRE>
  useradd -d $dir -m -s $shell -u $uid $username</PRE>
<P>is the default.  If the shellmachine-useradd configuration file exists but
it empty,</P>
<PRE>
  cp -pr /etc/skel $dir; chown -R $uid.$gid $dir</PRE>
<P>is the default instead.  Otherwise the contents of the file are treated as
a double-quoted perl string, with the following variables available:
$username, $uid, $gid, $dir, and $shell.</P>
<P>(TODOC: cyrus config file, <A HREF=".././FS/queue.html">the FS::queue manpage</A> and <A HREF=".././bin/freeside-queued.html">the freeside-queued manpage</A>)</P>
<P></P>
<DT><STRONG><A NAME="item_delete">delete</A></STRONG><BR>
<DD>
Deletes this account from the database.  If there is an error, returns the
error, otherwise returns false.
<P>The corresponding FS::cust_svc record will be deleted as well.</P>
<P>If the configuration value (see <A HREF=".././FS/Conf.html">the FS::Conf manpage</A>) shellmachine exists, the
<CODE>command(s)</CODE> specified in the shellmachine-userdel configuration file are
added to the job queue (see <A HREF=".././FS/queue.html">the FS::queue manpage</A> and <A HREF=".././bin/freeside-queued.html">the freeside-queued manpage</A>) to be executed
on shellmachine via ssh.  This behavior can be surpressed by setting
$FS::svc_acct::nossh_hack true.  If the shellmachine-userdel configuration
file does not exist,</P>
<PRE>
  userdel $username</PRE>
<P>is the default.  If the shellmachine-userdel configuration file exists but
is empty,</P>
<PRE>
  rm -rf $dir</PRE>
<P>is the default instead.  Otherwise the contents of the file are treated as a
double-quoted perl string, with the following variables available:
$username and $dir.</P>
<P>(TODOC: cyrus config file)</P>
<P></P>
<DT><STRONG><A NAME="item_replace_OLD_RECORD">replace OLD_RECORD</A></STRONG><BR>
<DD>
Replaces OLD_RECORD with this one in the database.  If there is an error,
returns the error, otherwise returns false.
<P>If the configuration value (see <A HREF=".././FS/Conf.html">the FS::Conf manpage</A>) shellmachine exists, and the 
dir field has changed, the <CODE>command(s)</CODE> specified in the shellmachine-usermod
configuraiton file are added to the job queue (see <A HREF=".././FS/queue.html">the FS::queue manpage</A> and
<A HREF=".././bin/freeside-queued.html">the freeside-queued manpage</A>) to be executed on shellmachine via ssh.  This behavior can
be surpressed by setting $FS::svc-acct::nossh_hack true.  If the
shellmachine-userdel configuration file does not exist or is empty,</P>
<PRE>
  [ -d $old_dir ] &amp;&amp; mv $old_dir $new_dir || (
    chmod u+t $old_dir;
    mkdir $new_dir;
    cd $old_dir;
    find . -depth -print | cpio -pdm $new_dir;
    chmod u-t $new_dir;
    chown -R $uid.$gid $new_dir;
    rm -rf $old_dir
  )</PRE>
<P>is the default.  This behaviour can be surpressed by setting
$FS::svc_acct::nossh_hack true.</P>
<P></P>
<DT><STRONG><A NAME="item_suspend">suspend</A></STRONG><BR>
<DD>
Suspends this account by prefixing *SUSPENDED* to the password.  If there is an
error, returns the error, otherwise returns false.
<P>Called by the suspend method of FS::cust_pkg (see <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>).</P>
<P></P>
<DT><STRONG><A NAME="item_unsuspend">unsuspend</A></STRONG><BR>
<DD>
Unsuspends this account by removing *SUSPENDED* from the password.  If there is
an error, returns the error, otherwise returns false.
<P>Called by the unsuspend method of FS::cust_pkg (see <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>).</P>
<P></P>
<DT><STRONG><A NAME="item_cancel">cancel</A></STRONG><BR>
<DD>
Just returns false (no error) for now.
<P>Called by the cancel method of FS::cust_pkg (see <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>).</P>
<P></P>
<DT><STRONG><A NAME="item_check">check</A></STRONG><BR>
<DD>
Checks all fields to make sure this is a valid service.  If there is an error,
returns the error, otherwise returns false.  Called by the insert and replace
methods.
<P>Sets any fixed values; see <A HREF=".././FS/part_svc.html">the FS::part_svc manpage</A>.</P>
<P></P>
<DT><STRONG><A NAME="item_radius">radius</A></STRONG><BR>
<DD>
Depriciated, use radius_reply instead.
<P></P>
<DT><STRONG><A NAME="item_radius_reply">radius_reply</A></STRONG><BR>
<DD>
Returns key/value pairs, suitable for assigning to a hash, for any RADIUS
reply attributes of this record.
<P>Note that this is now the preferred method for reading RADIUS attributes - 
accessing the columns directly is discouraged, as the column names are
expected to change in the future.</P>
<P></P>
<DT><STRONG><A NAME="item_radius_check">radius_check</A></STRONG><BR>
<DD>
Returns key/value pairs, suitable for assigning to a hash, for any RADIUS
check attributes of this record.
<P>Accessing RADIUS attributes directly is not supported and will break in the
future.</P>
<P></P>
<DT><STRONG><A NAME="item_domain">domain</A></STRONG><BR>
<DD>
Returns the domain associated with this account.
<P></P>
<DT><STRONG><A NAME="item_svc_domain">svc_domain</A></STRONG><BR>
<DD>
Returns the FS::svc_domain record for this account's domain (see
<A HREF=".././FS/svc_domain.html">the FS::svc_domain manpage</A>.
<P></P>
<DT><STRONG><A NAME="item_cust_svc">cust_svc</A></STRONG><BR>
<DD>
Returns the FS::cust_svc record for this account (see <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>).
<P>sub cust_svc {
  my $self = shift;
  qsearchs( 'cust_svc', { 'svcnum' =&gt; $self-&gt;svcnum } );
}</P>
<P></P>
<DT><STRONG><A NAME="item_email">email</A></STRONG><BR>
<DD>
Returns an email address associated with the account.
<P></P>
<DT><STRONG><A NAME="item_seconds_since_TIMESTAMP">seconds_since TIMESTAMP</A></STRONG><BR>
<DD>
Returns the number of seconds this account has been online since TIMESTAMP.
See <A HREF=".././FS/session.html">the FS::session manpage</A>
<P>TIMESTAMP is specified as a UNIX timestamp; see <EM>perlfunc/``time''</EM>.  Also see
<A HREF="../Time/Local.html">the Time::Local manpage</A> and <A HREF="../Date/Parse.html">the Date::Parse manpage</A> for conversion functions.</P>
<P></P>
<DT><STRONG><A NAME="item_ssh">ssh</A></STRONG><BR>
<DD>
</DL>
<P>
<HR>
<H1><A NAME="version">VERSION</A></H1>
<P>$Id: svc_acct.html,v 1.2 2002-01-29 16:33:16 ivan Exp $</P>
<P>
<HR>
<H1><A NAME="bugs">BUGS</A></H1>
<P>The bits which ssh should fork before doing so (or maybe queue jobs for a
daemon).</P>
<P>The $recref stuff in sub check should be cleaned up.</P>
<P>The suspend, unsuspend and cancel methods update the database, but not the
current object.  This is probably a bug as it's unexpected and
counterintuitive.</P>
<P>
<HR>
<H1><A NAME="see also">SEE ALSO</A></H1>
<P><A HREF=".././FS/svc_Common.html">the FS::svc_Common manpage</A>, edit/part_svc.cgi from an installed web interface,
export.html from the base documentation, <A HREF=".././FS/Record.html">the FS::Record manpage</A>, <A HREF=".././FS/Conf.html">the FS::Conf manpage</A>,
<A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>, <A HREF=".././FS/part_svc.html">the FS::part_svc manpage</A>, <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>, <A HREF=".././FS/queue.html">the FS::queue manpage</A>,
<A HREF=".././bin/freeside-queued.html">the freeside-queued manpage</A>), <A HREF="../Net/SSH.html">the Net::SSH manpage</A>, <A HREF="#item_ssh">ssh</A>, <A HREF=".././FS/svc_acct_pop.html">the FS::svc_acct_pop manpage</A>,
schema.html from the base documentation.</P>

</BODY>

</HTML>