FS::svc_acct - Object methods for svc_acct records
use FS::svc_acct;
$record = new FS::svc_acct \%hash; $record = new FS::svc_acct { 'column' => 'value' };
$error = $record->insert;
$error = $new_record->replace($old_record);
$error = $record->delete;
$error = $record->check;
$error = $record->suspend;
$error = $record->unsuspend;
$error = $record->cancel;
An FS::svc_acct object represents an account. FS::svc_acct inherits from FS::svc_Common. The following fields are currently supported:
Creates a new account. To add the account to the database, see insert.
Adds this account to the database. If there is an error, returns the error, otherwise returns false.
The additional fields pkgnum and svcpart (see FS::cust_svc) should be defined. An FS::cust_svc record will be created and inserted.
If the configuration value (see FS::Conf) shellmachine exists, and the username, uid, and dir fields are defined, the command
useradd -d $dir -m -s $shell -u $uid $username
is executed on shellmachine via ssh. This behaviour can be surpressed by setting $FS::svc_acct::nossh_hack true.
Deletes this account from the database. If there is an error, returns the error, otherwise returns false.
The corresponding FS::cust_svc record will be deleted as well.
If the configuration value (see FS::Conf) shellmachine exists, the command:
userdel $username
is executed on shellmachine via ssh. This behaviour can be surpressed by setting $FS::svc_acct::nossh_hack true.
Replaces OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
If the configuration value (see FS::Conf) shellmachine exists, and the dir field has changed, the command:
[ -d $old_dir ] && ( chmod u+t $old_dir; umask 022; 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 )
is executed on shellmachine via ssh. This behaviour can be surpressed by setting $FS::svc_acct::nossh_hack true.
Suspends this account by prefixing *SUSPENDED* to the password. If there is an error, returns the error, otherwise returns false.
Called by the suspend method of FS::cust_pkg (see FS::cust_pkg).
Unsuspends this account by removing *SUSPENDED* from the password. If there is an error, returns the error, otherwise returns false.
Called by the unsuspend method of FS::cust_pkg (see FS::cust_pkg).
Just returns false (no error) for now.
Called by the cancel method of FS::cust_pkg (see FS::cust_pkg).
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.
Sets any fixed values; see FS::part_svc.
$Id: svc_acct.html,v 1.2 2000-03-03 18:22:43 ivan Exp $
The remote commands should be configurable.
The bits which ssh should fork before doing so.
The $recref
stuff in sub check should be cleaned up.
FS::svc_Common, FS::Record, FS::Conf, FS::cust_svc, FS::part_svc, FS::cust_pkg, FS::SSH, ssh, FS::svc_acct_pop, schema.html from the base documentation.