3 <TITLE>FS::svc_acct - Object methods for svc_acct records</TITLE>
4 <LINK REV="made" HREF="mailto:perl@packages.debian.org">
9 <A NAME="__index__"></A>
14 <LI><A HREF="#name">NAME</A></LI>
15 <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
16 <LI><A HREF="#description">DESCRIPTION</A></LI>
17 <LI><A HREF="#methods">METHODS</A></LI>
18 <LI><A HREF="#version">VERSION</A></LI>
19 <LI><A HREF="#bugs">BUGS</A></LI>
20 <LI><A HREF="#see also">SEE ALSO</A></LI>
26 <H1><A NAME="name">NAME</A></H1>
27 <P>FS::svc_acct - Object methods for svc_acct records</P>
30 <H1><A NAME="synopsis">SYNOPSIS</A></H1>
32 use FS::svc_acct;</PRE>
34 $record = new FS::svc_acct \%hash;
35 $record = new FS::svc_acct { 'column' => 'value' };</PRE>
37 $error = $record->insert;</PRE>
39 $error = $new_record->replace($old_record);</PRE>
41 $error = $record->delete;</PRE>
43 $error = $record->check;</PRE>
45 $error = $record->suspend;</PRE>
47 $error = $record->unsuspend;</PRE>
49 $error = $record->cancel;</PRE>
51 %hash = $record->radius;</PRE>
53 %hash = $record->radius_reply;</PRE>
55 %hash = $record->radius_check;</PRE>
57 $domain = $record->domain;</PRE>
59 $svc_domain = $record->svc_domain;</PRE>
61 $email = $record->email;</PRE>
63 $seconds_since = $record->seconds_since($timestamp);</PRE>
66 <H1><A NAME="description">DESCRIPTION</A></H1>
67 <P>An FS::svc_acct object represents an account. FS::svc_acct inherits from
68 FS::svc_Common. The following fields are currently supported:</P>
70 <DT><STRONG><A NAME="item_key">svcnum - primary key (assigned automatcially for new accounts)</A></STRONG><BR>
72 <DT><STRONG><A NAME="item_username">username</A></STRONG><BR>
74 <DT><STRONG><A NAME="item__password_%2D_generated_if_blank">_password - generated if blank</A></STRONG><BR>
76 <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>
78 <DT><STRONG><A NAME="item_uid">uid</A></STRONG><BR>
80 <DT><STRONG><A NAME="item_gid">gid</A></STRONG><BR>
82 <DT><STRONG><A NAME="item_finger_%2D_GECOS">finger - GECOS</A></STRONG><BR>
84 <DT><STRONG><A NAME="item_blank">dir - set automatically if blank (and uid is not)</A></STRONG><BR>
86 <DT><STRONG><A NAME="item_shell">shell</A></STRONG><BR>
88 <DT><STRONG><A NAME="item_quota_%2D_%28unimplementd%29">quota - (unimplementd)</A></STRONG><BR>
90 <DT><STRONG><A NAME="item_slipip_%2D_IP_address">slipip - IP address</A></STRONG><BR>
92 <DT><STRONG><A NAME="item_seconds_%2D">seconds -</A></STRONG><BR>
94 <DT><STRONG><A NAME="item_domsvc_%2D_svcnum_from_svc_domain">domsvc - svcnum from svc_domain</A></STRONG><BR>
96 <DT><STRONG><A NAME="item_radius_Radius_Attribute_%2D_Radius%2DAttribute">radius_<EM>Radius_Attribute</EM> - <EM>Radius-Attribute</EM></A></STRONG><BR>
98 <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>
103 <H1><A NAME="methods">METHODS</A></H1>
105 <DT><STRONG><A NAME="item_new">new HASHREF</A></STRONG><BR>
107 Creates a new account. To add the account to the database, see <A HREF="#insert">insert</A>.
109 <DT><STRONG><A NAME="item_insert">insert</A></STRONG><BR>
111 Adds this account to the database. If there is an error, returns the error,
112 otherwise returns false.
113 <P>The additional fields pkgnum and svcpart (see <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>) should be
114 defined. An FS::cust_svc record will be created and inserted.</P>
115 <P>If the configuration value (see <A HREF=".././FS/Conf.html">the FS::Conf manpage</A>) shellmachine exists, and the
116 username, uid, and dir fields are defined, the <CODE>command(s)</CODE> specified in
117 the shellmachine-useradd configuration are added to the job queue (see
118 <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.
119 This behaviour can be surpressed by setting $FS::svc_acct::nossh_hack true.
120 If the shellmachine-useradd configuration file does not exist,</P>
122 useradd -d $dir -m -s $shell -u $uid $username</PRE>
123 <P>is the default. If the shellmachine-useradd configuration file exists but
126 cp -pr /etc/skel $dir; chown -R $uid.$gid $dir</PRE>
127 <P>is the default instead. Otherwise the contents of the file are treated as
128 a double-quoted perl string, with the following variables available:
129 $username, $uid, $gid, $dir, and $shell.</P>
130 <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>
132 <DT><STRONG><A NAME="item_delete">delete</A></STRONG><BR>
134 Deletes this account from the database. If there is an error, returns the
135 error, otherwise returns false.
136 <P>The corresponding FS::cust_svc record will be deleted as well.</P>
137 <P>If the configuration value (see <A HREF=".././FS/Conf.html">the FS::Conf manpage</A>) shellmachine exists, the
138 <CODE>command(s)</CODE> specified in the shellmachine-userdel configuration file are
139 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
140 on shellmachine via ssh. This behavior can be surpressed by setting
141 $FS::svc_acct::nossh_hack true. If the shellmachine-userdel configuration
142 file does not exist,</P>
144 userdel $username</PRE>
145 <P>is the default. If the shellmachine-userdel configuration file exists but
149 <P>is the default instead. Otherwise the contents of the file are treated as a
150 double-quoted perl string, with the following variables available:
151 $username and $dir.</P>
152 <P>(TODOC: cyrus config file)</P>
154 <DT><STRONG><A NAME="item_replace_OLD_RECORD">replace OLD_RECORD</A></STRONG><BR>
156 Replaces OLD_RECORD with this one in the database. If there is an error,
157 returns the error, otherwise returns false.
158 <P>If the configuration value (see <A HREF=".././FS/Conf.html">the FS::Conf manpage</A>) shellmachine exists, and the
159 dir field has changed, the <CODE>command(s)</CODE> specified in the shellmachine-usermod
160 configuraiton file are added to the job queue (see <A HREF=".././FS/queue.html">the FS::queue manpage</A> and
161 <A HREF=".././bin/freeside-queued.html">the freeside-queued manpage</A>) to be executed on shellmachine via ssh. This behavior can
162 be surpressed by setting $FS::svc-acct::nossh_hack true. If the
163 shellmachine-userdel configuration file does not exist or is empty,</P>
165 [ -d $old_dir ] && mv $old_dir $new_dir || (
169 find . -depth -print | cpio -pdm $new_dir;
171 chown -R $uid.$gid $new_dir;
174 <P>is the default. This behaviour can be surpressed by setting
175 $FS::svc_acct::nossh_hack true.</P>
177 <DT><STRONG><A NAME="item_suspend">suspend</A></STRONG><BR>
179 Suspends this account by prefixing *SUSPENDED* to the password. If there is an
180 error, returns the error, otherwise returns false.
181 <P>Called by the suspend method of FS::cust_pkg (see <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>).</P>
183 <DT><STRONG><A NAME="item_unsuspend">unsuspend</A></STRONG><BR>
185 Unsuspends this account by removing *SUSPENDED* from the password. If there is
186 an error, returns the error, otherwise returns false.
187 <P>Called by the unsuspend method of FS::cust_pkg (see <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>).</P>
189 <DT><STRONG><A NAME="item_cancel">cancel</A></STRONG><BR>
191 Just returns false (no error) for now.
192 <P>Called by the cancel method of FS::cust_pkg (see <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>).</P>
194 <DT><STRONG><A NAME="item_check">check</A></STRONG><BR>
196 Checks all fields to make sure this is a valid service. If there is an error,
197 returns the error, otherwise returns false. Called by the insert and replace
199 <P>Sets any fixed values; see <A HREF=".././FS/part_svc.html">the FS::part_svc manpage</A>.</P>
201 <DT><STRONG><A NAME="item_radius">radius</A></STRONG><BR>
203 Depriciated, use radius_reply instead.
205 <DT><STRONG><A NAME="item_radius_reply">radius_reply</A></STRONG><BR>
207 Returns key/value pairs, suitable for assigning to a hash, for any RADIUS
208 reply attributes of this record.
209 <P>Note that this is now the preferred method for reading RADIUS attributes -
210 accessing the columns directly is discouraged, as the column names are
211 expected to change in the future.</P>
213 <DT><STRONG><A NAME="item_radius_check">radius_check</A></STRONG><BR>
215 Returns key/value pairs, suitable for assigning to a hash, for any RADIUS
216 check attributes of this record.
217 <P>Accessing RADIUS attributes directly is not supported and will break in the
220 <DT><STRONG><A NAME="item_domain">domain</A></STRONG><BR>
222 Returns the domain associated with this account.
224 <DT><STRONG><A NAME="item_svc_domain">svc_domain</A></STRONG><BR>
226 Returns the FS::svc_domain record for this account's domain (see
227 <A HREF=".././FS/svc_domain.html">the FS::svc_domain manpage</A>.
229 <DT><STRONG><A NAME="item_cust_svc">cust_svc</A></STRONG><BR>
231 Returns the FS::cust_svc record for this account (see <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>).
234 qsearchs( 'cust_svc', { 'svcnum' => $self->svcnum } );
237 <DT><STRONG><A NAME="item_email">email</A></STRONG><BR>
239 Returns an email address associated with the account.
241 <DT><STRONG><A NAME="item_seconds_since_TIMESTAMP">seconds_since TIMESTAMP</A></STRONG><BR>
243 Returns the number of seconds this account has been online since TIMESTAMP.
244 See <A HREF=".././FS/session.html">the FS::session manpage</A>
245 <P>TIMESTAMP is specified as a UNIX timestamp; see <EM>perlfunc/``time''</EM>. Also see
246 <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>
248 <DT><STRONG><A NAME="item_ssh">ssh</A></STRONG><BR>
253 <H1><A NAME="version">VERSION</A></H1>
254 <P>$Id: svc_acct.html,v 1.3 2002-01-29 17:42:46 ivan Exp $</P>
257 <H1><A NAME="bugs">BUGS</A></H1>
258 <P>The bits which ssh should fork before doing so (or maybe queue jobs for a
260 <P>The $recref stuff in sub check should be cleaned up.</P>
261 <P>The suspend, unsuspend and cancel methods update the database, but not the
262 current object. This is probably a bug as it's unexpected and
263 counterintuitive.</P>
266 <H1><A NAME="see also">SEE ALSO</A></H1>
267 <P><A HREF=".././FS/svc_Common.html">the FS::svc_Common manpage</A>, edit/part_svc.cgi from an installed web interface,
268 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>,
269 <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>,
270 <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>,
271 schema.html from the base documentation.</P>