% include( '/elements/header.html', 'Developer Documentation' ) %> <& /elements/menubar.html, 'Freeside Perl Modules' => $fsurl.'docs/library/FS.html', 'Complete Index' => $fsurl.'docs/library/index.html', &>
FS::session - Object methods for session records
use FS::session;
$record = new FS::session \%hash;
$record = new FS::session {
'portnum' => 1,
'svcnum' => 2,
'login' => $timestamp,
'logout' => $timestamp,
};
$error = $record->insert;
$error = $new_record->replace($old_record);
$error = $record->delete;
$error = $record->check;
$error = $record->nas_heartbeat($timestamp);
An FS::session object represents an user login session. FS::session inherits from FS::Record. The following fields are currently supported:
Creates a new session. To add the session to the database, see "insert".
Note that this stores the hash reference, not a distinct copy of the hash it points to. You can ask the object for a copy with the hash method.
Adds this record to the database. If there is an error, returns the error, otherwise returns false. If the `login' field is empty, it is replaced with the current time.
Delete this record from the database.
Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false. If the `logout' field is empty, it is replaced with the current time.
Checks all fields to make sure this is a valid session. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
Heartbeats the nas associated with this session (see FS::nas).
Returns the svc_acct record associated with this session (see FS::svc_acct).
Maybe you shouldn't be able to insert a session if there's currently an open session on that port. Or maybe the open session on that port should be flagged as problematic? autoclosed? *sigh*
Hmm, sessions refer to current svc_acct records... probably need to constrain deletions to svc_acct records such that no svc_acct records are deleted which have a session (even if long-closed).
FS::Record, schema.html from the base documentation.