71513: Card tokenization [upgrade implemented]
[freeside.git] / bin / fs-radius-add-reply
index 2f38fbc..c6c24e0 100755 (executable)
@@ -1,20 +1,18 @@
 #!/usr/bin/perl -Tw
 
 # quick'n'dirty hack of fs-setup to add radius attributes
+# (i'm not sure this even works in the new world of schema changes - everyone
+#  uses attributes via groups now)
 
 use strict;
 use DBI;
-use FS::UID qw(adminsuidsetup checkeuid getsecrets);
+use FS::UID qw(adminsuidsetup);
 use FS::raddb;
 
-die "Not running uid freeside!" unless checkeuid();
-
 my %attrib2db =
   map { lc($FS::raddb::attrib{$_}) => $_ } keys %FS::raddb::attrib;
 
 my $user = shift or die &usage;
-getsecrets($user);
-
 my $dbh = adminsuidsetup $user;
 
 ###
@@ -39,12 +37,21 @@ my($char_d) = 80; #default maxlength for text fields
 ###
 
 foreach my $attribute ( @attributes ) {
+
   my $statement =
     "ALTER TABLE svc_acct ADD COLUMN radius_$attribute varchar($char_d) NULL";
   my $sth = $dbh->prepare( $statement )
     or warn "Error preparing $statement: ". $dbh->errstr;
-  $sth->execute
+  my $rc = $sth->execute
     or warn "Error executing $statement: ". $sth->errstr;
+
+  $statement =
+    "ALTER TABLE h_svc_acct ADD COLUMN radius_$attribute varchar($char_d) NULL";
+  $sth = $dbh->prepare( $statement )
+    or warn "Error preparing $statement: ". $dbh->errstr;
+  $rc = $sth->execute
+    or warn "Error executing $statement: ". $sth->errstr;
+
 }
 
 $dbh->commit or die $dbh->errstr;
@@ -54,7 +61,7 @@ $dbh->disconnect or die $dbh->errstr;
 print "\n\n", "Now you must run dbdef-create.\n\n";
 
 sub usage {
-  die "Usage:\n  fs-radius-add user\n"; 
+  die "Usage:\n  fs-radius-add-reply user\n"; 
 }