[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 7be7470ff6f590cb2c53c0e3d4b51fee60da900c

Ivan ivan at 420.am
Tue Jul 31 14:00:33 PDT 2012


The branch, FREESIDE_2_3_BRANCH has been updated
       via  7be7470ff6f590cb2c53c0e3d4b51fee60da900c (commit)
      from  0978786074b8a7b22be82991848f343368f87eb3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7be7470ff6f590cb2c53c0e3d4b51fee60da900c
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Jul 31 14:00:33 2012 -0700

    add strip_tld option to sqlradius_withdomain export, RT#18718

diff --git a/FS/FS/part_export/sqlradius_withdomain.pm b/FS/FS/part_export/sqlradius_withdomain.pm
index e5a7151..2af9e8d 100644
--- a/FS/FS/part_export/sqlradius_withdomain.pm
+++ b/FS/FS/part_export/sqlradius_withdomain.pm
@@ -6,11 +6,16 @@ use FS::part_export::sqlradius;
 
 tie my %options, 'Tie::IxHash', %FS::part_export::sqlradius::options;
 
+$options{'strip_tld'} = { type  => 'checkbox',
+                          label => 'Strip TLD from realm names',
+                        };
+
 %info = (
   'svc'      => 'svc_acct',
   'desc'     => 'Real-time export to SQL-backed RADIUS (FreeRADIUS, ICRADIUS) with realms',
   'options'  => \%options,
   'nodomain' => '',
+  'default_svc_class' => 'Internet',
   'notes' => $FS::part_export::sqlradius::notes1.
              'This export exports domains to RADIUS realms (see also '.
              'sqlradius).  '.
@@ -21,7 +26,11 @@ tie my %options, 'Tie::IxHash', %FS::part_export::sqlradius::options;
 
 sub export_username {
   my($self, $svc_acct) = (shift, shift);
-  $svc_acct->email;
+  my $email = $svc_acct->email;
+  if ( $self->option('strip_tld') ) {
+    $email =~ s/\.\w+$//;
+  }
+  $email;
 }
 
 1;

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/part_export/sqlradius_withdomain.pm |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)




More information about the freeside-commits mailing list