c714337be625503af54d49ff20b87765bb94836e
[freeside.git] / htdocs / docs / man / FS / session.html
1 <HTML>
2 <HEAD>
3 <TITLE>FS::session - Object methods for session records</TITLE>
4 <LINK REV="made" HREF="mailto:perl@packages.debian.org">
5 </HEAD>
6
7 <BODY>
8
9 <A NAME="__index__"></A>
10 <!-- INDEX BEGIN -->
11
12 <UL>
13
14         <LI><A HREF="#name">NAME</A></LI>
15         <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
16         <LI><A HREF="#description">DESCRIPTION</A></LI>
17         <LI><A HREF="#methods">METHODS</A></LI>
18         <LI><A HREF="#version">VERSION</A></LI>
19         <LI><A HREF="#bugs">BUGS</A></LI>
20         <LI><A HREF="#see also">SEE ALSO</A></LI>
21 </UL>
22 <!-- INDEX END -->
23
24 <HR>
25 <P>
26 <H1><A NAME="name">NAME</A></H1>
27 <P>FS::session - Object methods for session records</P>
28 <P>
29 <HR>
30 <H1><A NAME="synopsis">SYNOPSIS</A></H1>
31 <PRE>
32   use FS::session;</PRE>
33 <PRE>
34   $record = new FS::session \%hash;
35   $record = new FS::session {
36     'portnum' =&gt; 1,
37     'svcnum'  =&gt; 2,
38     'login'   =&gt; $timestamp,
39     'logout'  =&gt; $timestamp,
40   };</PRE>
41 <PRE>
42   $error = $record-&gt;insert;</PRE>
43 <PRE>
44   $error = $new_record-&gt;replace($old_record);</PRE>
45 <PRE>
46   $error = $record-&gt;delete;</PRE>
47 <PRE>
48   $error = $record-&gt;check;</PRE>
49 <PRE>
50   $error = $record-&gt;nas_heartbeat($timestamp);</PRE>
51 <P>
52 <HR>
53 <H1><A NAME="description">DESCRIPTION</A></H1>
54 <P>An FS::session object represents an user login session.  FS::session inherits
55 from FS::Record.  The following fields are currently supported:</P>
56 <DL>
57 <DT><STRONG><A NAME="item_sessionnum_%2D_primary_key">sessionnum - primary key</A></STRONG><BR>
58 <DD>
59 <DT><STRONG><A NAME="item_portnum_%2D_NAS_port_for_this_session_%2D_see_FS%3">portnum - NAS port for this session - see <A HREF=".././FS/port.html">the FS::port manpage</A></A></STRONG><BR>
60 <DD>
61 <DT><STRONG><A NAME="item_svcnum_%2D_User_for_this_session_%2D_see_FS%3A%3As">svcnum - User for this session - see <A HREF=".././FS/svc_acct.html">the FS::svc_acct manpage</A></A></STRONG><BR>
62 <DD>
63 <DT><STRONG><A NAME="item_login_%2D_timestamp_indicating_the_beginning_of_th">login - timestamp indicating the beginning of this user session.</A></STRONG><BR>
64 <DD>
65 <DT><STRONG><A NAME="item_logout_%2D_timestamp_indicating_the_end_of_this_us">logout - timestamp indicating the end of this user session.  May be null,
66                which indicates a currently open session.</A></STRONG><BR>
67 <DD>
68 </DL>
69 <P>
70 <HR>
71 <H1><A NAME="methods">METHODS</A></H1>
72 <DL>
73 <DT><STRONG><A NAME="item_new">new HASHREF</A></STRONG><BR>
74 <DD>
75 Creates a new session.  To add the session to the database, see <A HREF="#insert">insert</A>.
76 <P>Note that this stores the hash reference, not a distinct copy of the hash it
77 points to.  You can ask the object for a copy with the <EM>hash</EM> method.</P>
78 <P></P>
79 <DT><STRONG><A NAME="item_insert">insert</A></STRONG><BR>
80 <DD>
81 Adds this record to the database.  If there is an error, returns the error,
82 otherwise returns false.  If the `login' field is empty, it is replaced with
83 the current time.
84 <P></P>
85 <DT><STRONG><A NAME="item_delete">delete</A></STRONG><BR>
86 <DD>
87 Delete this record from the database.
88 <P></P>
89 <DT><STRONG><A NAME="item_replace_OLD_RECORD">replace OLD_RECORD</A></STRONG><BR>
90 <DD>
91 Replaces the OLD_RECORD with this one in the database.  If there is an error,
92 returns the error, otherwise returns false.  If the `logout' field is empty,
93 it is replaced with the current time.
94 <P></P>
95 <DT><STRONG><A NAME="item_check">check</A></STRONG><BR>
96 <DD>
97 Checks all fields to make sure this is a valid session.  If there is
98 an error, returns the error, otherwise returns false.  Called by the insert
99 and replace methods.
100 <P></P>
101 <DT><STRONG><A NAME="item_nas_heartbeat">nas_heartbeat</A></STRONG><BR>
102 <DD>
103 Heartbeats the nas associated with this session (see <A HREF=".././FS/nas.html">the FS::nas manpage</A>).
104 <P></P>
105 <DT><STRONG><A NAME="item_svc_acct">svc_acct</A></STRONG><BR>
106 <DD>
107 Returns the svc_acct record associated with this session (see <A HREF=".././FS/svc_acct.html">the FS::svc_acct manpage</A>).
108 <P></P></DL>
109 <P>
110 <HR>
111 <H1><A NAME="version">VERSION</A></H1>
112 <P>$Id: session.html,v 1.1 2001-04-23 12:41:57 ivan Exp $</P>
113 <P>
114 <HR>
115 <H1><A NAME="bugs">BUGS</A></H1>
116 <P>Maybe you shouldn't be able to insert a session if there's currently an open
117 session on that port.  Or maybe the open session on that port should be flagged
118 as problematic?  autoclosed?  *sigh*</P>
119 <P>Hmm, sessions refer to current svc_acct records... probably need to constrain
120 deletions to svc_acct records such that no svc_acct records are deleted which
121 have a session (even if long-closed).</P>
122 <P>
123 <HR>
124 <H1><A NAME="see also">SEE ALSO</A></H1>
125 <P><A HREF=".././FS/Record.html">the FS::Record manpage</A>, schema.html from the base documentation.</P>
126
127 </BODY>
128
129 </HTML>