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:
- sessionnum - primary key
-
- portnum - NAS port for this session - see the FS::port manpage
-
- svcnum - User for this session - see the FS::svc_acct manpage
-
- login - timestamp indicating the beginning of this user session.
-
- logout - timestamp indicating the end of this user session. May be null,
which indicates a currently open session.
-
- new HASHREF
-
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.
- insert
-
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
-
Delete this record from the database.
- replace OLD_RECORD
-
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.
- check
-
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.
- nas_heartbeat
-
Heartbeats the nas associated with this session (see the FS::nas manpage).
- svc_acct
-
Returns the svc_acct record associated with this session (see the FS::svc_acct manpage).
$Id: session.html,v 1.3 2002-01-29 17:42:46 ivan Exp $
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).
the FS::Record manpage, schema.html from the base documentation.