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;
%hash = $record->radius;
%hash = $record->radius_reply;
%hash = $record->radius_check;
$domain = $record->domain;
$svc_domain = $record->svc_domain;
$email = $record->email;
$seconds_since = $record->seconds_since($timestamp);
An FS::svc_acct object represents an account. FS::svc_acct inherits from FS::svc_Common. The following fields are currently supported:
The additional fields pkgnum and svcpart (see the FS::cust_svc manpage) should be defined. An FS::cust_svc record will be created and inserted.
If the configuration value (see the FS::Conf manpage) shellmachine exists, and the
username, uid, and dir fields are defined, the command(s)
specified in
the shellmachine-useradd configuration are added to the job queue (see
the FS::queue manpage and the freeside-queued manpage) to be exectued on shellmachine via ssh.
This behaviour can be surpressed by setting $FS::svc_acct::nossh_hack true.
If the shellmachine-useradd configuration file does not exist,
useradd -d $dir -m -s $shell -u $uid $username
is the default. If the shellmachine-useradd configuration file exists but it empty,
cp -pr /etc/skel $dir; chown -R $uid.$gid $dir
is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username, $uid, $gid, $dir, and $shell.
(TODOC: cyrus config file, the FS::queue manpage and the freeside-queued manpage)
The corresponding FS::cust_svc record will be deleted as well.
If the configuration value (see the FS::Conf manpage) shellmachine exists, the
command(s)
specified in the shellmachine-userdel configuration file are
added to the job queue (see the FS::queue manpage and the freeside-queued manpage) to be executed
on shellmachine via ssh. This behavior can be surpressed by setting
$FS::svc_acct::nossh_hack true. If the shellmachine-userdel configuration
file does not exist,
userdel $username
is the default. If the shellmachine-userdel configuration file exists but is empty,
rm -rf $dir
is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username and $dir.
(TODOC: cyrus config file)
If the configuration value (see the FS::Conf manpage) shellmachine exists, and the
dir field has changed, the command(s)
specified in the shellmachine-usermod
configuraiton file are added to the job queue (see the FS::queue manpage and
the freeside-queued manpage) to be executed on shellmachine via ssh. This behavior can
be surpressed by setting $FS::svc-acct::nossh_hack true. If the
shellmachine-userdel configuration file does not exist or is empty,
[ -d $old_dir ] && mv $old_dir $new_dir || ( chmod u+t $old_dir; 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 the default. This behaviour can be surpressed by setting $FS::svc_acct::nossh_hack true.
Called by the suspend method of FS::cust_pkg (see the FS::cust_pkg manpage).
Called by the unsuspend method of FS::cust_pkg (see the FS::cust_pkg manpage).
Called by the cancel method of FS::cust_pkg (see the FS::cust_pkg manpage).
Sets any fixed values; see the FS::part_svc manpage.
Note that this is now the preferred method for reading RADIUS attributes - accessing the columns directly is discouraged, as the column names are expected to change in the future.
Accessing RADIUS attributes directly is not supported and will break in the future.
sub cust_svc { my $self = shift; qsearchs( 'cust_svc', { 'svcnum' => $self->svcnum } ); }
TIMESTAMP is specified as a UNIX timestamp; see perlfunc/``time''. Also see the Time::Local manpage and the Date::Parse manpage for conversion functions.
$Id: svc_acct.html,v 1.3 2002-01-29 17:42:46 ivan Exp $
The bits which ssh should fork before doing so (or maybe queue jobs for a daemon).
The $recref stuff in sub check should be cleaned up.
The suspend, unsuspend and cancel methods update the database, but not the current object. This is probably a bug as it's unexpected and counterintuitive.
the FS::svc_Common manpage, edit/part_svc.cgi from an installed web interface, export.html from the base documentation, the FS::Record manpage, the FS::Conf manpage, the FS::cust_svc manpage, the FS::part_svc manpage, the FS::cust_pkg manpage, the FS::queue manpage, the freeside-queued manpage), the Net::SSH manpage, ssh, the FS::svc_acct_pop manpage, schema.html from the base documentation.