X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_export%2Fbroadband_sqlradius.pm;h=45f286f17dd874977eed8a4519e2f54efee7e578;hb=7f5e32275a5a2674fd1d220cd651b222b9831476;hp=ae0876ddf59a4b4365bcf7391aeeb701e5b86ec0;hpb=7aef2e455fe8a4722036f231ee8609ac63b2a9c9;p=freeside.git diff --git a/FS/FS/part_export/broadband_sqlradius.pm b/FS/FS/part_export/broadband_sqlradius.pm index ae0876ddf..45f286f17 100644 --- a/FS/FS/part_export/broadband_sqlradius.pm +++ b/FS/FS/part_export/broadband_sqlradius.pm @@ -26,6 +26,15 @@ tie %options, 'Tie::IxHash', # type => 'checkbox', # label => 'Hide IP address on session reports', # }, + 'mac_case' => { + label => 'Export MAC address as', + type => 'select', + options => [ qw(uppercase lowercase) ], + }, + 'mac_delimiter' => { + label => 'Separate MAC address octets with', + default => '-', + }, 'mac_as_password' => { type => 'checkbox', default => '1', @@ -34,7 +43,11 @@ tie %options, 'Tie::IxHash', 'radius_password' => { label=>'Fixed password' }, 'ip_addr_as' => { label => 'Send IP address as', default => 'Framed-IP-Address' }, -; + 'export_attrs' => { + type => 'checkbox', + label => 'Export RADIUS group attributes to this database', + }, + ; %info = ( 'svc' => 'svc_broadband', @@ -63,9 +76,19 @@ END sub rebless { shift; } +sub _mac_format { + my $self = shift; + my $addr = shift; + if ( $self->option('mac_case',1) eq 'lowercase' ) { + $addr = lc($addr); + } + join( ($self->option('mac_delimiter',1) || ''), $addr =~ /../g ); +} + sub export_username { my($self, $svc_broadband) = (shift, shift); - $svc_broadband->mac_addr; + my $mac_addr = $svc_broadband->mac_addr; + $self->_mac_format($svc_broadband->mac_addr); } sub radius_reply { @@ -83,7 +106,7 @@ sub radius_check { my $password_attrib = $conf->config('radius-password') || 'Password'; my %check; if ( $self->option('mac_as_password') ) { - $check{$password_attrib} = $svc_broadband->mac_addr; #formatting? + $check{$password_attrib} = $self->_mac_format($svc_broadband->mac_addr); } elsif ( length( $self->option('radius_password',1)) ) { $check{$password_attrib} = $self->option('radius_password');