524fe33243b068e1b89a4a273d095465153f2922
[freeside.git] / htdocs / docs / man / FS / svc_acct.html
1 <HTML>
2 <HEAD>
3 <TITLE>FS::svc_acct - Object methods for svc_acct records</TITLE>
4 <LINK REV="made" HREF="mailto:perl@packages.debian.org">
5 </HEAD>
6
7 <BODY>
8
9 <A NAME="__index__"></A>
10 <!-- INDEX BEGIN -->
11
12 <UL>
13
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>
21 </UL>
22 <!-- INDEX END -->
23
24 <HR>
25 <P>
26 <H1><A NAME="name">NAME</A></H1>
27 <P>FS::svc_acct - Object methods for svc_acct records</P>
28 <P>
29 <HR>
30 <H1><A NAME="synopsis">SYNOPSIS</A></H1>
31 <PRE>
32   use FS::svc_acct;</PRE>
33 <PRE>
34   $record = new FS::svc_acct \%hash;
35   $record = new FS::svc_acct { 'column' =&gt; 'value' };</PRE>
36 <PRE>
37   $error = $record-&gt;insert;</PRE>
38 <PRE>
39   $error = $new_record-&gt;replace($old_record);</PRE>
40 <PRE>
41   $error = $record-&gt;delete;</PRE>
42 <PRE>
43   $error = $record-&gt;check;</PRE>
44 <PRE>
45   $error = $record-&gt;suspend;</PRE>
46 <PRE>
47   $error = $record-&gt;unsuspend;</PRE>
48 <PRE>
49   $error = $record-&gt;cancel;</PRE>
50 <PRE>
51   %hash = $record-&gt;radius;</PRE>
52 <P>
53 <HR>
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>
57 <DL>
58 <DT><STRONG><A NAME="item_key">svcnum - primary key (assigned automatcially for new accounts)</A></STRONG><BR>
59 <DD>
60 <DT><STRONG><A NAME="item_username">username</A></STRONG><BR>
61 <DD>
62 <DT><STRONG><A NAME="item__password_%2D_generated_if_blank">_password - generated if blank</A></STRONG><BR>
63 <DD>
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>
65 <DD>
66 <DT><STRONG><A NAME="item_uid">uid</A></STRONG><BR>
67 <DD>
68 <DT><STRONG><A NAME="item_gid">gid</A></STRONG><BR>
69 <DD>
70 <DT><STRONG><A NAME="item_finger_%2D_GECOS">finger - GECOS</A></STRONG><BR>
71 <DD>
72 <DT><STRONG><A NAME="item_blank">dir - set automatically if blank (and uid is not)</A></STRONG><BR>
73 <DD>
74 <DT><STRONG><A NAME="item_shell">shell</A></STRONG><BR>
75 <DD>
76 <DT><STRONG><A NAME="item_quota_%2D_%28unimplementd%29">quota - (unimplementd)</A></STRONG><BR>
77 <DD>
78 <DT><STRONG><A NAME="item_slipip_%2D_IP_address">slipip - IP address</A></STRONG><BR>
79 <DD>
80 <DT><STRONG><A NAME="item_radius_Radius_Attribute_%2D_Radius%2DAttribute">radius_<EM>Radius_Attribute</EM> - <EM>Radius-Attribute</EM></A></STRONG><BR>
81 <DD>
82 </DL>
83 <P>
84 <HR>
85 <H1><A NAME="methods">METHODS</A></H1>
86 <DL>
87 <DT><STRONG><A NAME="item_new">new HASHREF</A></STRONG><BR>
88 <DD>
89 Creates a new account.  To add the account to the database, see <A HREF="#insert">insert</A>.
90 <P></P>
91 <DT><STRONG><A NAME="item_insert">insert</A></STRONG><BR>
92 <DD>
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>
102 <PRE>
103   useradd -d $dir -m -s $shell -u $uid $username</PRE>
104 <P>is the default.  If the shellmachine-useradd configuration file exists but
105 it empty,</P>
106 <PRE>
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>
111 <P></P>
112 <DT><STRONG><A NAME="item_delete">delete</A></STRONG><BR>
113 <DD>
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>
122 <PRE>
123   userdel $username</PRE>
124 <P>is the default.  If the shellmachine-userdel configuration file exists but
125 is empty,</P>
126 <PRE>
127   rm -rf $dir</PRE>
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>
131 <P></P>
132 <DT><STRONG><A NAME="item_replace_OLD_RECORD">replace OLD_RECORD</A></STRONG><BR>
133 <DD>
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>
141 <PRE>
142   [ -d $old_dir ] &amp;&amp; mv $old_dir $new_dir || (
143     chmod u+t $old_dir;
144     mkdir $new_dir;
145     cd $old_dir;
146     find . -depth -print | cpio -pdm $new_dir;
147     chmod u-t $new_dir;
148     chown -R $uid.$gid $new_dir;
149     rm -rf $old_dir
150   )</PRE>
151 <P>is executed on shellmachine via ssh.  This behaviour can be surpressed by
152 setting $FS::svc_acct::nossh_hack true.</P>
153 <P></P>
154 <DT><STRONG><A NAME="item_suspend">suspend</A></STRONG><BR>
155 <DD>
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>
159 <P></P>
160 <DT><STRONG><A NAME="item_unsuspend">unsuspend</A></STRONG><BR>
161 <DD>
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>
165 <P></P>
166 <DT><STRONG><A NAME="item_cancel">cancel</A></STRONG><BR>
167 <DD>
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>
170 <P></P>
171 <DT><STRONG><A NAME="item_check">check</A></STRONG><BR>
172 <DD>
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
175 methods.
176 <P>Sets any fixed values; see <A HREF=".././FS/part_svc.html">the FS::part_svc manpage</A>.</P>
177 <P></P>
178 <DT><STRONG><A NAME="item_radius">radius</A></STRONG><BR>
179 <DD>
180 Depriciated, use radius_reply instead.
181 <P></P>
182 <DT><STRONG><A NAME="item_radius_reply">radius_reply</A></STRONG><BR>
183 <DD>
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>
189 <P></P>
190 <DT><STRONG><A NAME="item_radius_check">radius_check</A></STRONG><BR>
191 <DD>
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
195 future.</P>
196 <P></P></DL>
197 <P>
198 <HR>
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>
201 <P>
202 <HR>
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
205 daemon).</P>
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>
210 <P>
211 <HR>
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>
216
217 </BODY>
218
219 </HTML>