X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fport.pm;h=620030afc56cc8a67e8d03df4aa2b5095a29a62a;hp=c1bdee9754f11ef9479fce587df95fa576471cee;hb=5d154e4e153a66c2349ee0c6ca942fa017bfb139;hpb=eea322178c024e57730831556d28a78524df7450 diff --git a/FS/FS/port.pm b/FS/FS/port.pm index c1bdee975..620030afc 100644 --- a/FS/FS/port.pm +++ b/FS/FS/port.pm @@ -4,6 +4,7 @@ use strict; use vars qw( @ISA ); use FS::Record qw( qsearchs ); use FS::nas; +use FS::session; @ISA = qw(FS::Record); @@ -26,6 +27,8 @@ FS::port - Object methods for port records $error = $record->check; + $session = $port->session; + =head1 DESCRIPTION An FS::port object represents an individual port on a NAS. FS::port inherits @@ -101,7 +104,7 @@ sub check { my $self = shift; my $error = $self->ut_numbern('portnum') - || $self->ut_ipn('ipn') + || $self->ut_ipn('ip') || $self->ut_numbern('nasport') || $self->ut_number('nasnum'); ; @@ -110,46 +113,46 @@ sub check { unless $self->ip || $self->nasport; return "Unknown nasnum" unless qsearchs('nas', { 'nasnum' => $self->nasnum } ); - ''; #no error + $self->SUPER::check; } -=back - -=head1 VERSION - -$Id: port.pm,v 1.1 2000-10-27 20:18:32 ivan Exp $ +=item session -=head1 BUGS - -The author forgot to customize this manpage. +Returns the currently open session on this port, or if no session is currently +open, the most recent session. See L. -=head1 SEE ALSO +=cut -L, schema.html from the base documentation. +sub session { + my $self = shift; + qsearchs('session', { 'portnum' => $self->portnum }, '*', + 'ORDER BY login DESC LIMIT 1' ); +} -=head1 HISTORY +=back -ivan@voicenet.com 97-jul-1 +=head1 VERSION -added hfields -ivan@sisd.com 97-nov-13 +$Id: port.pm,v 1.6 2003-08-05 00:20:45 khoff Exp $ -$Log: port.pm,v $ -Revision 1.1 2000-10-27 20:18:32 ivan -oops, also necessary for session monitor +=head1 BUGS -Revision 1.1 1999/08/04 08:03:03 ivan -move table subclass examples out of production directory +The author forgot to customize this manpage. -Revision 1.4 1998/12/29 11:59:57 ivan -mostly properly OO, some work still to be done with svc_ stuff +The session method won't deal well if you have multiple open sessions on a +port, for example if your RADIUS server drops B records. Suggestions for +how to deal with this sort of lossage welcome; should we close the session +when we get a new session on that port? Tag it as invalid somehow? Close it +one second after it was opened? *sigh* Maybe FS::session shouldn't let you +create overlapping sessions, at least folks will find out their logging is +dropping records. -Revision 1.3 1998/11/15 04:33:00 ivan -updates for newest versoin +If you think the above refers multiple user logins you need to read the +manpages again. -Revision 1.2 1998/11/15 03:48:49 ivan -update for current version +=head1 SEE ALSO +L, schema.html from the base documentation. =cut