NAME

FS::svc_acct - Object methods for svc_acct records


SYNOPSIS

  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;


DESCRIPTION

An FS::svc_acct object represents an account. FS::svc_acct inherits from FS::svc_Common. The following fields are currently supported:

svcnum - primary key (assigned automatcially for new accounts)
username
_password - generated if blank
popnum - Point of presence (see FS::svc_acct_pop)
uid
gid
finger - GECOS
dir - set automatically if blank (and uid is not)
shell
quota - (unimplementd)
slipip - IP address
radius_Radius_Attribute - Radius-Attribute


METHODS

new HASHREF

Creates a new account. To add the account to the database, see insert.

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.

delete

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.

replace OLD_RECORD

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.

suspend

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).

unsuspend

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).

cancel

Just returns false (no error) for now.

Called by the cancel method of FS::cust_pkg (see FS::cust_pkg).

check

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.


VERSION

$Id: svc_acct.html,v 1.2 2000-03-03 18:22:43 ivan Exp $


BUGS

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.


SEE ALSO

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.