4b307455e07197e8af7586748040e837735b9019
[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:ivan@rootwood.sisd.com">
5 </HEAD>
6
7 <BODY>
8
9 <!-- INDEX BEGIN -->
10
11 <UL>
12
13         <LI><A HREF="#NAME">NAME</A>
14         <LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
15         <LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
16         <LI><A HREF="#METHODS">METHODS</A>
17         <LI><A HREF="#VERSION">VERSION</A>
18         <LI><A HREF="#BUGS">BUGS</A>
19         <LI><A HREF="#SEE_ALSO">SEE ALSO</A>
20 </UL>
21 <!-- INDEX END -->
22
23 <HR>
24 <P>
25 <H1><A NAME="NAME">NAME</A></H1>
26 <P>
27 FS::svc_acct - Object methods for svc_acct records
28
29 <P>
30 <HR>
31 <H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
32 <P>
33 <PRE>  use FS::svc_acct;
34 </PRE>
35 <P>
36 <PRE>  $record = new FS::svc_acct \%hash;
37   $record = new FS::svc_acct { 'column' =&gt; 'value' };
38 </PRE>
39 <P>
40 <PRE>  $error = $record-&gt;insert;
41 </PRE>
42 <P>
43 <PRE>  $error = $new_record-&gt;replace($old_record);
44 </PRE>
45 <P>
46 <PRE>  $error = $record-&gt;delete;
47 </PRE>
48 <P>
49 <PRE>  $error = $record-&gt;check;
50 </PRE>
51 <P>
52 <PRE>  $error = $record-&gt;suspend;
53 </PRE>
54 <P>
55 <PRE>  $error = $record-&gt;unsuspend;
56 </PRE>
57 <P>
58 <PRE>  $error = $record-&gt;cancel;
59 </PRE>
60 <P>
61 <HR>
62 <H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
63 <P>
64 An FS::svc_acct object represents an account. FS::svc_acct inherits from
65 FS::svc_Common. The following fields are currently supported:
66
67 <DL>
68 <DT><STRONG><A NAME="item_svcnum">svcnum - primary key (assigned automatcially for new accounts)</A></STRONG><DD>
69 <DT><STRONG><A NAME="item_username">username</A></STRONG><DD>
70 <DT><STRONG><A NAME="item__password">_password - generated if blank</A></STRONG><DD>
71 <DT><STRONG><A NAME="item_popnum">popnum - Point of presence (see FS::svc_acct_pop)</A></STRONG><DD>
72 <DT><STRONG><A NAME="item_uid">uid</A></STRONG><DD>
73 <DT><STRONG><A NAME="item_gid">gid</A></STRONG><DD>
74 <DT><STRONG><A NAME="item_finger">finger - GECOS</A></STRONG><DD>
75 <DT><STRONG><A NAME="item_dir">dir - set automatically if blank (and uid is not)</A></STRONG><DD>
76 <DT><STRONG><A NAME="item_shell">shell</A></STRONG><DD>
77 <DT><STRONG><A NAME="item_quota">quota - (unimplementd)</A></STRONG><DD>
78 <DT><STRONG><A NAME="item_slipip">slipip - IP address</A></STRONG><DD>
79 <DT><STRONG><A NAME="item_radius_Radius_Attribute">radius_Radius_Attribute - Radius-Attribute</A></STRONG><DD>
80 </DL>
81 <P>
82 <HR>
83 <H1><A NAME="METHODS">METHODS</A></H1>
84 <DL>
85 <DT><STRONG><A NAME="item_new">new HASHREF</A></STRONG><DD>
86 <P>
87 Creates a new account. To add the account to the database, see <A HREF="#insert">insert</A>.
88
89 <DT><STRONG><A NAME="item_insert">insert</A></STRONG><DD>
90 <P>
91 Adds this account to the database. If there is an error, returns the error,
92 otherwise returns false.
93
94 <P>
95 The additional fields pkgnum and svcpart (see <A HREF="../FS/cust_svc.html">FS::cust_svc</A>) should be defined. An FS::cust_svc record will be created and inserted.
96
97 <P>
98 If the configuration value (see <A HREF="../FS/Conf.html">FS::Conf</A>) shellmachine exists, and the username, uid, and dir fields are defined,
99 the command
100
101 <P>
102 <PRE>  useradd -d $dir -m -s $shell -u $uid $username
103 </PRE>
104 <P>
105 is executed on shellmachine via ssh. This behaviour can be surpressed by
106 setting $FS::svc_acct::nossh_hack true.
107
108 <DT><STRONG><A NAME="item_delete">delete</A></STRONG><DD>
109 <P>
110 Deletes this account from the database. If there is an error, returns the
111 error, otherwise returns false.
112
113 <P>
114 The corresponding FS::cust_svc record will be deleted as well.
115
116 <P>
117 If the configuration value (see <A HREF="../FS/Conf.html">FS::Conf</A>) shellmachine exists, the command:
118
119 <P>
120 <PRE>  userdel $username
121 </PRE>
122 <P>
123 is executed on shellmachine via ssh. This behaviour can be surpressed by
124 setting $FS::svc_acct::nossh_hack true.
125
126 <DT><STRONG><A NAME="item_replace">replace OLD_RECORD</A></STRONG><DD>
127 <P>
128 Replaces OLD_RECORD with this one in the database. If there is an error,
129 returns the error, otherwise returns false.
130
131 <P>
132 If the configuration value (see <A HREF="../FS/Conf.html">FS::Conf</A>) shellmachine exists, and the dir field has changed, the command:
133
134 <P>
135 <PRE>  [ -d $old_dir ] &amp;&amp; (
136     chmod u+t $old_dir;
137     umask 022;
138     mkdir $new_dir;
139     cd $old_dir;
140     find . -depth -print | cpio -pdm $new_dir;
141     chmod u-t $new_dir;
142     chown -R $uid.$gid $new_dir;
143     rm -rf $old_dir
144   )
145 </PRE>
146 <P>
147 is executed on shellmachine via ssh. This behaviour can be surpressed by
148 setting $FS::svc_acct::nossh_hack true.
149
150 <DT><STRONG><A NAME="item_suspend">suspend</A></STRONG><DD>
151 <P>
152 Suspends this account by prefixing *SUSPENDED* to the password. If there is
153 an error, returns the error, otherwise returns false.
154
155 <P>
156 Called by the suspend method of FS::cust_pkg (see <A HREF="../FS/cust_pkg.html">FS::cust_pkg</A>).
157
158 <DT><STRONG><A NAME="item_unsuspend">unsuspend</A></STRONG><DD>
159 <P>
160 Unsuspends this account by removing *SUSPENDED* from the password. If there
161 is an error, returns the error, otherwise returns false.
162
163 <P>
164 Called by the unsuspend method of FS::cust_pkg (see <A HREF="../FS/cust_pkg.html">FS::cust_pkg</A>).
165
166 <DT><STRONG><A NAME="item_cancel">cancel</A></STRONG><DD>
167 <P>
168 Just returns false (no error) for now.
169
170 <P>
171 Called by the cancel method of FS::cust_pkg (see <A HREF="../FS/cust_pkg.html">FS::cust_pkg</A>).
172
173 <DT><STRONG><A NAME="item_check">check</A></STRONG><DD>
174 <P>
175 Checks all fields to make sure this is a valid service. If there is an
176 error, returns the error, otherwise returns false. Called by the insert and
177 replace methods.
178
179 <P>
180 Sets any fixed values; see <A HREF="../FS/part_svc.html">FS::part_svc</A>.
181
182 </DL>
183 <P>
184 <HR>
185 <H1><A NAME="VERSION">VERSION</A></H1>
186 <P>
187 $Id: svc_acct.html,v 1.1 1999-08-04 12:13:27 ivan Exp $
188
189 <P>
190 <HR>
191 <H1><A NAME="BUGS">BUGS</A></H1>
192 <P>
193 The remote commands should be configurable.
194
195 <P>
196 The bits which ssh should fork before doing so.
197
198 <P>
199 The <CODE>$recref</CODE> stuff in sub check should be cleaned up.
200
201 <P>
202 <HR>
203 <H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
204 <P>
205 <A HREF="../FS/svc_Common.html">FS::svc_Common</A>, <A HREF="../FS/Record.html">FS::Record</A>, <A HREF="../FS/Conf.html">FS::Conf</A>, <A HREF="../FS/cust_svc.html">FS::cust_svc</A>,
206 <A HREF="../FS/part_svc.html">FS::part_svc</A>, <A HREF="../FS/cust_pkg.html">FS::cust_pkg</A>, <A HREF="../FS/SSH.html">FS::SSH</A>, <EM>ssh</EM>, <A HREF="../FS/svc_acct_pop.html">FS::svc_acct_pop</A>, schema.html from the base documentation.
207
208 </BODY>
209
210 </HTML>