[freeside-commits] freeside/FS/bin freeside-sqlradius-reset, 1.16, 1.17

Mark Wells mark at wavetail.420.am
Wed Nov 23 10:42:53 PST 2011


Update of /home/cvs/cvsroot/freeside/FS/bin
In directory wavetail.420.am:/tmp/cvs-serv15174/FS/bin

Modified Files:
	freeside-sqlradius-reset 
Log Message:
RADIUS group attributes, #15017

Index: freeside-sqlradius-reset
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-sqlradius-reset,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -w -d -r1.16 -r1.17
--- freeside-sqlradius-reset	21 Nov 2011 00:23:13 -0000	1.16
+++ freeside-sqlradius-reset	23 Nov 2011 18:42:50 -0000	1.17
@@ -35,7 +35,10 @@
       map { $export->option($_) } qw( datasrc username password )
     ) or die $DBI::errstr;
     my $usergroup = $export->option('usergroup') || 'usergroup';
-    for my $table (qw( radcheck radreply ), $usergroup) {
+    my @attr_tables;
+    @attr_tables = qw( radgroupcheck radgroupreply )
+      if $export->option('export_attrs');
+    for my $table (qw( radcheck radreply ), $usergroup, @attr_tables) {
       my $sth = $icradius_dbh->prepare("DELETE FROM $table");
       $sth->execute or die "Can't reset $table table: ". $sth->errstr;
     }
@@ -47,6 +50,9 @@
 $FS::svc_Common::overlimit_missing_cust_svc_nonfatal_kludge = 1;
 $FS::svc_Common::overlimit_missing_cust_svc_nonfatal_kludge = 1;
 
+# this is the same across all exports, for now
+my @radius_attrs = qsearch('radius_attr', {});
+
 foreach my $export ( @exports ) {
 
   #my @svcparts = map { $_->svcpart } $export->export_svc;
@@ -85,6 +91,13 @@
     die $error if $error;
 
   }
+
+  if ( $export->option('export_attrs') ) {
+    foreach my $attr (@radius_attrs) {
+      my $error = $export->export_attr_insert($attr);
+      die $error if $error;
+    }
+  }
 }
 
 sub usage {



More information about the freeside-commits mailing list