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>
54 <H1><A NAME="description">DESCRIPTION</A></H1>
55 <P>An FS::svc_acct object represents an account. FS::svc_acct inherits from
56 FS::svc_Common. The following fields are currently supported:</P>
58 <DT><STRONG><A NAME="item_key">svcnum - primary key (assigned automatcially for new accounts)</A></STRONG><BR>
60 <DT><STRONG><A NAME="item_username">username</A></STRONG><BR>
62 <DT><STRONG><A NAME="item__password_%2D_generated_if_blank">_password - generated if blank</A></STRONG><BR>
64 <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>
66 <DT><STRONG><A NAME="item_uid">uid</A></STRONG><BR>
68 <DT><STRONG><A NAME="item_gid">gid</A></STRONG><BR>
70 <DT><STRONG><A NAME="item_finger_%2D_GECOS">finger - GECOS</A></STRONG><BR>
72 <DT><STRONG><A NAME="item_blank">dir - set automatically if blank (and uid is not)</A></STRONG><BR>
74 <DT><STRONG><A NAME="item_shell">shell</A></STRONG><BR>
76 <DT><STRONG><A NAME="item_quota_%2D_%28unimplementd%29">quota - (unimplementd)</A></STRONG><BR>
78 <DT><STRONG><A NAME="item_slipip_%2D_IP_address">slipip - IP address</A></STRONG><BR>
80 <DT><STRONG><A NAME="item_radius_Radius_Attribute_%2D_Radius%2DAttribute">radius_<EM>Radius_Attribute</EM> - <EM>Radius-Attribute</EM></A></STRONG><BR>
85 <H1><A NAME="methods">METHODS</A></H1>
87 <DT><STRONG><A NAME="item_new">new HASHREF</A></STRONG><BR>
89 Creates a new account. To add the account to the database, see <A HREF="#insert">insert</A>.
91 <DT><STRONG><A NAME="item_insert">insert</A></STRONG><BR>
93 Adds this account to the database. If there is an error, returns the error,
94 otherwise returns false.
95 <P>The additional fields pkgnum and svcpart (see <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>) should be
96 defined. An FS::cust_svc record will be created and inserted.</P>
97 <P>If the configuration value (see <A HREF=".././FS/Conf.html">the FS::Conf manpage</A>) shellmachine exists, and the
98 username, uid, and dir fields are defined, the <CODE>command(s)</CODE> specified in
99 the shellmachine-useradd configuration are exectued on shellmachine via ssh.
100 This behaviour can be surpressed by setting $FS::svc_acct::nossh_hack true.
101 If the shellmachine-useradd configuration file does not exist,</P>
103 useradd -d $dir -m -s $shell -u $uid $username</PRE>
104 <P>is the default. If the shellmachine-useradd configuration file exists but
107 cp -pr /etc/skel $dir; chown -R $uid.$gid $dir</PRE>
108 <P>is the default instead. Otherwise the contents of the file are treated as
109 a double-quoted perl string, with the following variables available:
110 $username, $uid, $gid, $dir, and $shell.</P>
112 <DT><STRONG><A NAME="item_delete">delete</A></STRONG><BR>
114 Deletes this account from the database. If there is an error, returns the
115 error, otherwise returns false.
116 <P>The corresponding FS::cust_svc record will be deleted as well.</P>
117 <P>If the configuration value (see <A HREF=".././FS/Conf.html">the FS::Conf manpage</A>) shellmachine exists, the
118 <CODE>command(s)</CODE> specified in the shellmachine-userdel configuration file are
119 executed on shellmachine via ssh. This behavior can be surpressed by setting
120 $FS::svc_acct::nossh_hack true. If the shellmachine-userdel configuration
121 file does not exist,</P>
123 userdel $username</PRE>
124 <P>is the default. If the shellmachine-userdel configuration file exists but
128 <P>is the default instead. Otherwise the contents of the file are treated as a
129 double-quoted perl string, with the following variables available:
130 $username and $dir.</P>
132 <DT><STRONG><A NAME="item_replace_OLD_RECORD">replace OLD_RECORD</A></STRONG><BR>
134 Replaces OLD_RECORD with this one in the database. If there is an error,
135 returns the error, otherwise returns false.
136 <P>If the configuration value (see <A HREF=".././FS/Conf.html">the FS::Conf manpage</A>) shellmachine exists, and the
137 dir field has changed, the <CODE>command(s)</CODE> specified in the shellmachine-usermod
138 configuraiton file are executed on shellmachine via ssh. This behavior can
139 be surpressed by setting $FS::svc-acct::nossh_hack true. If the
140 shellmachine-userdel configuration file does not exist or is empty, :</P>
142 [ -d $old_dir ] && mv $old_dir $new_dir || (
146 find . -depth -print | cpio -pdm $new_dir;
148 chown -R $uid.$gid $new_dir;
151 <P>is executed on shellmachine via ssh. This behaviour can be surpressed by
152 setting $FS::svc_acct::nossh_hack true.</P>
154 <DT><STRONG><A NAME="item_suspend">suspend</A></STRONG><BR>
156 Suspends this account by prefixing *SUSPENDED* to the password. If there is an
157 error, returns the error, otherwise returns false.
158 <P>Called by the suspend method of FS::cust_pkg (see <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>).</P>
160 <DT><STRONG><A NAME="item_unsuspend">unsuspend</A></STRONG><BR>
162 Unsuspends this account by removing *SUSPENDED* from the password. If there is
163 an error, returns the error, otherwise returns false.
164 <P>Called by the unsuspend method of FS::cust_pkg (see <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>).</P>
166 <DT><STRONG><A NAME="item_cancel">cancel</A></STRONG><BR>
168 Just returns false (no error) for now.
169 <P>Called by the cancel method of FS::cust_pkg (see <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>).</P>
171 <DT><STRONG><A NAME="item_check">check</A></STRONG><BR>
173 Checks all fields to make sure this is a valid service. If there is an error,
174 returns the error, otherwise returns false. Called by the insert and replace
176 <P>Sets any fixed values; see <A HREF=".././FS/part_svc.html">the FS::part_svc manpage</A>.</P>
178 <DT><STRONG><A NAME="item_radius">radius</A></STRONG><BR>
180 Depriciated, use radius_reply instead.
182 <DT><STRONG><A NAME="item_radius_reply">radius_reply</A></STRONG><BR>
184 Returns key/value pairs, suitable for assigning to a hash, for any RADIUS
185 reply attributes of this record.
186 <P>Note that this is now the preferred method for reading RADIUS attributes -
187 accessing the columns directly is discouraged, as the column names are
188 expected to change in the future.</P>
190 <DT><STRONG><A NAME="item_radius_check">radius_check</A></STRONG><BR>
192 Returns key/value pairs, suitable for assigning to a hash, for any RADIUS
193 check attributes of this record.
194 <P>Accessing RADIUS attributes directly is not supported and will break in the
199 <H1><A NAME="version">VERSION</A></H1>
200 <P>$Id: svc_acct.html,v 1.3 2001-04-23 12:40:31 ivan Exp $</P>
203 <H1><A NAME="bugs">BUGS</A></H1>
204 <P>The bits which ssh should fork before doing so (or maybe queue jobs for a
206 <P>The $recref stuff in sub check should be cleaned up.</P>
207 <P>The suspend, unsuspend and cancel methods update the database, but not the
208 current object. This is probably a bug as it's unexpected and
209 counterintuitive.</P>
212 <H1><A NAME="see also">SEE ALSO</A></H1>
213 <P><A HREF=".././FS/svc_Common.html">the FS::svc_Common manpage</A>, <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>,
214 <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="../Net/SSH.html">the Net::SSH manpage</A>, <EM>ssh</EM>, <A HREF=".././FS/svc_acct_pop.html">the FS::svc_acct_pop manpage</A>,
215 schema.html from the base documentation.</P>