NG auth: fix new customer, remove mapsecrets support, RT#21563
authorIvan Kohler <ivan@freeside.biz>
Tue, 7 May 2013 06:13:11 +0000 (23:13 -0700)
committerIvan Kohler <ivan@freeside.biz>
Tue, 7 May 2013 06:13:11 +0000 (23:13 -0700)
29 files changed:
FS/FS/Mason.pm
FS/FS/Record.pm
FS/FS/UI/Web.pm
FS/FS/UID.pm
FS/FS/banned_pay.pm
FS/FS/cust_credit.pm
FS/FS/cust_credit_bill.pm
FS/FS/cust_main.pm
FS/FS/cust_main/Status.pm
FS/FS/cust_pay.pm
FS/FS/cust_pay_refund.pm
FS/FS/cust_pay_void.pm
FS/FS/cust_pkg.pm
FS/FS/cust_refund.pm
FS/bin/freeside-setup
FS/bin/freeside-upgrade
bin/fs-migrate-svc_acct_sm [deleted file]
bin/fs-radius-add-check
bin/fs-radius-add-reply
httemplate/edit/cust_credit.cgi
httemplate/edit/cust_main.cgi
httemplate/edit/elements/ApplicationCommon.html
httemplate/edit/svc_acct.cgi
httemplate/edit/svc_cert.cgi
httemplate/edit/svc_domain.cgi
httemplate/elements/header.html
httemplate/index.html
httemplate/pref/pref-process.html
httemplate/pref/pref.html

index ae75539..43e9b06 100644 (file)
@@ -126,7 +126,7 @@ if ( -e $addl_handler_use_file ) {
   use LWP::UserAgent;
   use Storable qw( nfreeze thaw );
   use FS;
   use LWP::UserAgent;
   use Storable qw( nfreeze thaw );
   use FS;
-  use FS::UID qw( getotaker dbh datasrc driver_name );
+  use FS::UID qw( dbh datasrc driver_name );
   use FS::Record qw( qsearch qsearchs fields dbdef
                     str2time_sql str2time_sql_closing
                     midnight_sql
   use FS::Record qw( qsearch qsearchs fields dbdef
                     str2time_sql str2time_sql_closing
                     midnight_sql
index 42af68c..a868d48 100644 (file)
@@ -18,7 +18,7 @@ use Text::CSV_XS;
 use File::Slurp qw( slurp );
 use DBI qw(:sql_types);
 use DBIx::DBSchema 0.38;
 use File::Slurp qw( slurp );
 use DBI qw(:sql_types);
 use DBIx::DBSchema 0.38;
-use FS::UID qw(dbh getotaker datasrc driver_name);
+use FS::UID qw(dbh datasrc driver_name);
 use FS::CurrentUser;
 use FS::Schema qw(dbdef);
 use FS::SearchCache;
 use FS::CurrentUser;
 use FS::Schema qw(dbdef);
 use FS::SearchCache;
@@ -1901,7 +1901,11 @@ sub _h_statement {
   "INSERT INTO h_". $self->table. " ( ".
       join(', ', qw(history_date history_user history_action), @fields ).
     ") VALUES (".
   "INSERT INTO h_". $self->table. " ( ".
       join(', ', qw(history_date history_user history_action), @fields ).
     ") VALUES (".
-      join(', ', $time, dbh->quote(getotaker()), dbh->quote($action), @values).
+      join(', ', $time,
+                 dbh->quote( $FS::CurrentUser::CurrentUser->username ),
+                 dbh->quote($action),
+                 @values
+      ).
     ")"
   ;
 }
     ")"
   ;
 }
@@ -1932,11 +1936,6 @@ sub unique {
   #warn "field $field is tainted" if is_tainted($field);
 
   my($counter) = new File::CounterFile "$table.$field",0;
   #warn "field $field is tainted" if is_tainted($field);
 
   my($counter) = new File::CounterFile "$table.$field",0;
-# hack for web demo
-#  getotaker() =~ /^([\w\-]{1,16})$/ or die "Illegal CGI REMOTE_USER!";
-#  my($user)=$1;
-#  my($counter) = new File::CounterFile "$user/$table.$field",0;
-# endhack
 
   my $index = $counter->inc;
   $index = $counter->inc while qsearchs($table, { $field=>$index } );
 
   my $index = $counter->inc;
   $index = $counter->inc while qsearchs($table, { $field=>$index } );
index 7926808..c11e6c9 100644 (file)
@@ -579,7 +579,7 @@ use Carp;
 use Storable qw(nfreeze);
 use MIME::Base64;
 use JSON;
 use Storable qw(nfreeze);
 use MIME::Base64;
 use JSON;
-use FS::UID qw(getotaker);
+use FS::CurrentUser;
 use FS::Record qw(qsearchs);
 use FS::queue;
 use FS::CGI qw(rooturl);
 use FS::Record qw(qsearchs);
 use FS::queue;
 use FS::CGI qw(rooturl);
@@ -653,7 +653,7 @@ sub start_job {
       push @{$param{$field}}, $value;
     }
   }
       push @{$param{$field}}, $value;
     }
   }
-  $param{CurrentUser} = getotaker();
+  $param{CurrentUser} = $FS::CurrentUser::CurrentUser->username;
   $param{RootURL} = rooturl($self->{cgi}->self_url);
   warn "FS::UI::Web::start_job\n".
        join('', map {
   $param{RootURL} = rooturl($self->{cgi}->self_url);
   warn "FS::UI::Web::start_job\n".
        join('', map {
index 6596a98..9c52f08 100644 (file)
@@ -2,7 +2,7 @@ package FS::UID;
 
 use strict;
 use vars qw(
 
 use strict;
 use vars qw(
-  @ISA @EXPORT_OK $DEBUG $me $cgi $freeside_uid $user $conf_dir $cache_dir
+  @ISA @EXPORT_OK $DEBUG $me $cgi $freeside_uid $conf_dir $cache_dir
   $secrets $datasrc $db_user $db_pass $schema $dbh $driver_name
   $AutoCommit %callback @callback $callback_hack $use_confcompat
 );
   $secrets $datasrc $db_user $db_pass $schema $dbh $driver_name
   $AutoCommit %callback @callback $callback_hack $use_confcompat
 );
@@ -38,7 +38,7 @@ FS::UID - Subroutines for database login and assorted other stuff
 
 =head1 SYNOPSIS
 
 
 =head1 SYNOPSIS
 
-  use FS::UID qw(adminsuidsetup dbh datasrc getotaker checkeuid checkruid);
+  use FS::UID qw(adminsuidsetup dbh datasrc checkeuid checkruid);
 
   $dbh = adminsuidsetup $user;
 
 
   $dbh = adminsuidsetup $user;
 
@@ -73,7 +73,7 @@ sub adminsuidsetup {
 }
 
 sub forksuidsetup {
 }
 
 sub forksuidsetup {
-  $user = shift;
+  my $user = shift;
   my $olduser = $user;
   warn "$me forksuidsetup starting for $user\n" if $DEBUG;
 
   my $olduser = $user;
   warn "$me forksuidsetup starting for $user\n" if $DEBUG;
 
@@ -173,12 +173,12 @@ sub callback_setup {
 }
 
 sub myconnect {
 }
 
 sub myconnect {
-  my $handle = DBI->connect( getsecrets(@_), { 'AutoCommit'         => 0,
-                                               'ChopBlanks'         => 1,
-                                               'ShowErrorStatement' => 1,
-                                               'pg_enable_utf8'     => 1,
-                                               #'mysql_enable_utf8'  => 1,
-                                             }
+  my $handle = DBI->connect( getsecrets(), { 'AutoCommit'         => 0,
+                                             'ChopBlanks'         => 1,
+                                             'ShowErrorStatement' => 1,
+                                             'pg_enable_utf8'     => 1,
+                                             #'mysql_enable_utf8'  => 1,
+                                           }
                            )
     or die "DBI->connect error: $DBI::errstr\n";
 
                            )
     or die "DBI->connect error: $DBI::errstr\n";
 
@@ -276,12 +276,13 @@ sub suidsetup {
 
 =item getotaker
 
 
 =item getotaker
 
-Returns the current Freeside user.
+(Deprecated) Returns the current Freeside user's username.
 
 =cut
 
 sub getotaker {
 
 =cut
 
 sub getotaker {
-  $user;
+  carp "FS::UID::getotaker deprecated";
+  $FS::CurrentUser::CurrentUser->username;
 }
 
 =item checkeuid
 }
 
 =item checkeuid
@@ -305,34 +306,18 @@ sub checkruid {
   ( $< == $freeside_uid );
 }
 
   ( $< == $freeside_uid );
 }
 
-=item getsecrets [ USER ]
+=item getsecrets
 
 
-Sets the user to USER, if supplied.
-Sets and returns the DBI datasource, username and password for this user from
-the `/usr/local/etc/freeside/mapsecrets' file.
+Sets and returns the DBI datasource, username and password from
+the `/usr/local/etc/freeside/secrets' file.
 
 =cut
 
 sub getsecrets {
 
 =cut
 
 sub getsecrets {
-  my($setuser) = shift;
-  $user = $setuser if $setuser;
-
-  if ( -e "$conf_dir/mapsecrets" ) {
-    die "No user!" unless $user;
-    my($line) = grep /^\s*($user|\*)\s/,
-      map { /^(.*)$/; $1 } readline(new IO::File "$conf_dir/mapsecrets");
-    confess "User $user not found in mapsecrets!" unless $line;
-    $line =~ /^\s*($user|\*)\s+(.*)$/;
-    $secrets = $2;
-    die "Illegal mapsecrets line for user?!" unless $secrets;
-  } else {
-    # no mapsecrets file at all, so do the default thing
-    $secrets = 'secrets';
-  }
 
   ($datasrc, $db_user, $db_pass, $schema) = 
 
   ($datasrc, $db_user, $db_pass, $schema) = 
-    map { /^(.*)$/; $1 } readline(new IO::File "$conf_dir/$secrets")
-      or die "Can't get secrets: $conf_dir/$secrets: $!\n";
+    map { /^(.*)$/; $1 } readline(new IO::File "$conf_dir/secrets")
+      or die "Can't get secrets: $conf_dir/secrets: $!\n";
   undef $driver_name;
 
   ($datasrc, $db_user, $db_pass);
   undef $driver_name;
 
   ($datasrc, $db_user, $db_pass);
index b93f67b..713c81a 100644 (file)
@@ -4,7 +4,6 @@ use strict;
 use base qw( FS::otaker_Mixin FS::Record );
 use Digest::MD5 qw(md5_base64);
 use FS::Record qw( qsearch qsearchs );
 use base qw( FS::otaker_Mixin FS::Record );
 use Digest::MD5 qw(md5_base64);
 use FS::Record qw( qsearch qsearchs );
-use FS::UID qw( getotaker );
 use FS::CurrentUser;
 
 =head1 NAME
 use FS::CurrentUser;
 
 =head1 NAME
index ba279a2..0376f1d 100644 (file)
@@ -7,7 +7,7 @@ use vars qw( $conf $unsuspendauto $me $DEBUG
            );
 use List::Util qw( min );
 use Date::Format;
            );
 use List::Util qw( min );
 use Date::Format;
-use FS::UID qw( dbh getotaker );
+use FS::UID qw( dbh );
 use FS::Misc qw(send_email);
 use FS::Record qw( qsearch qsearchs dbdef );
 use FS::CurrentUser;
 use FS::Misc qw(send_email);
 use FS::Record qw( qsearch qsearchs dbdef );
 use FS::CurrentUser;
index 900a5c0..9ecb7e0 100644 (file)
@@ -2,7 +2,6 @@ package FS::cust_credit_bill;
 
 use strict;
 use vars qw( @ISA $conf );
 
 use strict;
 use vars qw( @ISA $conf );
-use FS::UID qw( getotaker );
 use FS::Record qw( qsearch qsearchs );
 use FS::cust_main_Mixin;
 use FS::cust_bill_ApplicationCommon;
 use FS::Record qw( qsearch qsearchs );
 use FS::cust_main_Mixin;
 use FS::cust_bill_ApplicationCommon;
index 2a4602e..3c0702f 100644 (file)
@@ -32,7 +32,7 @@ use Date::Format;
 use File::Temp; #qw( tempfile );
 use Business::CreditCard 0.28;
 use Locale::Country;
 use File::Temp; #qw( tempfile );
 use Business::CreditCard 0.28;
 use Locale::Country;
-use FS::UID qw( getotaker dbh driver_name );
+use FS::UID qw( dbh driver_name );
 use FS::Record qw( qsearchs qsearch dbdef regexp_sql );
 use FS::Misc qw( generate_email send_email generate_ps do_print );
 use FS::Msgcat qw(gettext);
 use FS::Record qw( qsearchs qsearch dbdef regexp_sql );
 use FS::Misc qw( generate_email send_email generate_ps do_print );
 use FS::Msgcat qw(gettext);
index e5803e0..f84ff0f 100644 (file)
@@ -2,13 +2,10 @@ package FS::cust_main::Status;
 
 use strict;
 use vars qw( $conf ); # $module ); #$DEBUG $me );
 
 use strict;
 use vars qw( $conf ); # $module ); #$DEBUG $me );
+use Tie::IxHash;
 use FS::UID;
 use FS::cust_pkg;
 
 use FS::UID;
 use FS::cust_pkg;
 
-#use Tie::IxHash;
-
-use FS::UID qw( getotaker dbh driver_name );
-
 #$DEBUG = 0;
 #$me = '[FS::cust_main::Status]';
 
 #$DEBUG = 0;
 #$me = '[FS::cust_main::Status]';
 
index 6d09f89..4491f78 100644 (file)
@@ -9,7 +9,6 @@ use vars qw( $DEBUG $me $conf @encrypted_fields
 use Date::Format;
 use Business::CreditCard;
 use Text::Template;
 use Date::Format;
 use Business::CreditCard;
 use Text::Template;
-use FS::UID qw( getotaker );
 use FS::Misc qw( send_email );
 use FS::Record qw( dbh qsearch qsearchs );
 use FS::CurrentUser;
 use FS::Misc qw( send_email );
 use FS::Record qw( dbh qsearch qsearchs );
 use FS::CurrentUser;
index cb9dbce..b799f69 100644 (file)
@@ -2,7 +2,6 @@ package FS::cust_pay_refund;
 
 use strict;
 use vars qw( @ISA ); #$conf );
 
 use strict;
 use vars qw( @ISA ); #$conf );
-use FS::UID qw( getotaker );
 use FS::Record qw( qsearchs ); # qsearch );
 use FS::cust_main;
 use FS::cust_pay;
 use FS::Record qw( qsearchs ); # qsearch );
 use FS::cust_main;
 use FS::cust_pay;
index 42fc296..92a96cb 100644 (file)
@@ -5,7 +5,6 @@ use base qw( FS::otaker_Mixin FS::payinfo_transaction_Mixin FS::cust_main_Mixin
              FS::Record );
 use vars qw( @encrypted_fields $otaker_upgrade_kludge );
 use Business::CreditCard;
              FS::Record );
 use vars qw( @encrypted_fields $otaker_upgrade_kludge );
 use Business::CreditCard;
-use FS::UID qw(getotaker);
 use FS::Record qw(qsearch qsearchs dbh fields);
 use FS::CurrentUser;
 use FS::access_user;
 use FS::Record qw(qsearch qsearchs dbh fields);
 use FS::CurrentUser;
 use FS::access_user;
index 374cf7a..19337c4 100644 (file)
@@ -10,7 +10,7 @@ use List::Util qw(min max);
 use Tie::IxHash;
 use Time::Local qw( timelocal timelocal_nocheck );
 use MIME::Entity;
 use Tie::IxHash;
 use Time::Local qw( timelocal timelocal_nocheck );
 use MIME::Entity;
-use FS::UID qw( getotaker dbh driver_name );
+use FS::UID qw( dbh driver_name );
 use FS::Misc qw( send_email );
 use FS::Record qw( qsearch qsearchs fields );
 use FS::CurrentUser;
 use FS::Misc qw( send_email );
 use FS::Record qw( qsearch qsearchs fields );
 use FS::CurrentUser;
index 45a170b..0649929 100644 (file)
@@ -5,7 +5,6 @@ use base qw( FS::otaker_Mixin FS::payinfo_transaction_Mixin FS::cust_main_Mixin
              FS::Record );
 use vars qw( @encrypted_fields );
 use Business::CreditCard;
              FS::Record );
 use vars qw( @encrypted_fields );
 use Business::CreditCard;
-use FS::UID qw(getotaker);
 use FS::Record qw( qsearch qsearchs dbh );
 use FS::CurrentUser;
 use FS::cust_credit;
 use FS::Record qw( qsearch qsearchs dbh );
 use FS::CurrentUser;
 use FS::cust_credit;
index 155c74a..07da88d 100755 (executable)
@@ -32,7 +32,7 @@ $config_dir =~ /^([\w.:=\/]+)$/
   or die "unacceptable configuration directory name";
 $config_dir = $1;
 
   or die "unacceptable configuration directory name";
 $config_dir = $1;
 
-getsecrets($opt_u);
+getsecrets();
 
 #needs to match FS::Record
 my($dbdef_file) = "%%%FREESIDE_CONF%%%/dbdef.". datasrc;
 
 #needs to match FS::Record
 my($dbdef_file) = "%%%FREESIDE_CONF%%%/dbdef.". datasrc;
index b08a840..399c119 100755 (executable)
@@ -5,7 +5,7 @@ use vars qw($opt_d $opt_s $opt_q $opt_v $opt_r);
 use vars qw($DEBUG $DRY_RUN);
 use Getopt::Std;
 use DBIx::DBSchema 0.31; #0.39
 use vars qw($DEBUG $DRY_RUN);
 use Getopt::Std;
 use DBIx::DBSchema 0.31; #0.39
-use FS::UID qw(adminsuidsetup checkeuid datasrc driver_name);  #getsecrets);
+use FS::UID qw(adminsuidsetup checkeuid datasrc driver_name);
 use FS::CurrentUser;
 use FS::Schema qw( dbdef dbdef_dist reload_dbdef );
 use FS::Misc::prune qw(prune_applications);
 use FS::CurrentUser;
 use FS::Schema qw( dbdef dbdef_dist reload_dbdef );
 use FS::Misc::prune qw(prune_applications);
diff --git a/bin/fs-migrate-svc_acct_sm b/bin/fs-migrate-svc_acct_sm
deleted file mode 100755 (executable)
index 07f7b61..0000000
+++ /dev/null
@@ -1,227 +0,0 @@
-#!/usr/bin/perl -Tw
-#
-# jeff@cmh.net 01-Jul-20
-
-#to delay loading dbdef until we're ready
-#BEGIN { $FS::Record::setup_hack = 1; }
-
-use strict;
-use Term::Query qw(query);
-#use DBI;
-#use DBIx::DBSchema;
-#use DBIx::DBSchema::Table;
-#use DBIx::DBSchema::Column;
-#use DBIx::DBSchema::ColGroup::Unique;
-#use DBIx::DBSchema::ColGroup::Index;
-use FS::Conf;
-use FS::UID qw(adminsuidsetup datasrc checkeuid getsecrets);
-use FS::Record qw(qsearch qsearchs);
-use FS::svc_domain;
-use FS::svc_forward;
-use vars qw( $conf $old_default_domain %part_domain_svc %part_acct_svc %part_forward_svc $svc_acct $svc_acct_sm $error);
-
-die "Not running uid freeside!" unless checkeuid();
-
-my $user = shift or die &usage;
-getsecrets($user);
-
-$conf = new FS::Conf;
-$old_default_domain = $conf->config('domain');
-
-#needs to match FS::Record
-#my($dbdef_file) = "/usr/local/etc/freeside/dbdef.". datasrc;
-
-###
-# This section would be the appropriate place to manipulate
-# the schema & tables.
-###
-
-##  we need to add the domsvc to svc_acct
-##  we must add a svc_forward record....
-##  I am thinking that the fields  svcnum (int), destsvc (int), and
-##  dest (varchar (80))  are appropriate, with destsvc/dest an either/or
-##  much in the spirit of cust_main_invoice
-
-###
-# massage the data
-###
-
-my($dbh)=adminsuidsetup $user;
-
-$|=1;
-
-$FS::svc_Common::noexport_hack = 1;
-$FS::svc_domain::whois_hack = 1;
-
-%part_domain_svc=map { $_->svcpart, $_ } qsearch('part_svc',{'svcdb'=>'svc_domain'});
-%part_acct_svc=map { $_->svcpart, $_ } qsearch('part_svc',{'svcdb'=>'svc_acct'});
-%part_forward_svc=map { $_->svcpart, $_ } qsearch('part_svc',{'svcdb'=>'svc_forward'});
-
-die "No services with svcdb svc_domain!\n" unless %part_domain_svc;
-die "No services with svcdb svc_acct!\n" unless %part_acct_svc;
-die "No services with svcdb svc_forward!\n" unless %part_forward_svc;
-
-my($svc_domain) = qsearchs('svc_domain', { 'domain' => $old_default_domain });
-if (! $svc_domain || $svc_domain->domain != $old_default_domain) {
-   print <<EOF;
-
-Your database currently does not contain a svc_domain record for the
-domain $old_default_domain.  Would you like me to add one for you?
-EOF
-
-   my($response)=scalar(<STDIN>);
-   chop $response;
-   if ($response =~ /^[yY]/) {
-      print "\n\n", &menu_domain_svc, "\n", <<END;
-I need to create new domain accounts.  Which service shall I use for that?
-END
-      my($domain_svcpart)=&getdomainpart;
-
-      $svc_domain = new FS::svc_domain {
-        'domain' => $old_default_domain,
-        'svcpart' => $domain_svcpart,
-        'action' => 'M',
-       };
-#      $error=$svc_domain->insert && die "Error adding domain $old_default_domain: $error";
-      $error=$svc_domain->insert;
-      die "Error adding domain $old_default_domain: $error" if $error;
-   }else{
-      print <<EOF;
-
-  This program cannot function properly until a svc_domain record matching
-your conf_dir/domain file exists.
-EOF
-
-      exit 1;
-   }
-}
-
-print "\n\n", &menu_acct_svc, "\n", <<END;
-I may need to create some new pop accounts and set up forwarding to them
-for some users.  Which service shall I use for that?
-END
-my($pop_svcpart)=&getacctpart;
-
-print "\n\n", &menu_forward_svc, "\n", <<END;
-I may need to create some new forwarding for some users.  Which service
-shall I use for that?
-END
-my($forward_svcpart)=&getforwardpart;
-
-sub menu_domain_svc {
-  ( join "\n", map "$_: ".$part_domain_svc{$_}->svc, sort keys %part_domain_svc ). "\n";
-}
-sub menu_acct_svc {
-  ( join "\n", map "$_: ".$part_acct_svc{$_}->svc, sort keys %part_acct_svc ). "\n";
-}
-sub menu_forward_svc {
-  ( join "\n", map "$_: ".$part_forward_svc{$_}->svc, sort keys %part_forward_svc ). "\n";
-}
-sub getdomainpart {
-  $^W=0; # Term::Query isn't -w-safe
-  my $return = query "Enter part number:", 'irk', [ keys %part_domain_svc ];
-  $^W=1;
-  $return;
-}
-sub getacctpart {
-  $^W=0; # Term::Query isn't -w-safe
-  my $return = query "Enter part number:", 'irk', [ keys %part_acct_svc ];
-  $^W=1;
-  $return;
-}
-sub getforwardpart {
-  $^W=0; # Term::Query isn't -w-safe
-  my $return = query "Enter part number:", 'irk', [ keys %part_forward_svc ];
-  $^W=1;
-  $return;
-}
-
-
-#migrate data
-
-my(@svc_accts) = qsearch('svc_acct', {});
-foreach $svc_acct (@svc_accts) {
-  my(@svc_acct_sms) = qsearch('svc_acct_sm', {
-      domuid => $svc_acct->getfield('uid'),
-      }
-    );
-
-  #  Ok.. we've got the svc_acct record, and an array of svc_acct_sm's
-  #  What do we do from here?
-
-  #  The intuitive:
-  #    plop the svc_acct into the 'default domain'
-  #    and then represent the svc_acct_sm's with svc_forwards
-  #    they can be gussied up manually, later
-  #
-  #  Perhaps better:
-  #    when no svc_acct_sm exists, place svc_acct in 'default domain'
-  #    when one svc_acct_sm exists, place svc_acct in corresponding
-  #      domain & possibly create a svc_forward in 'default domain'
-  #    when multiple svc_acct_sm's exists (in different domains) we'd
-  #    better use the 'intuitive' approach.
-  #
-  #  Specific way:
-  #    as 'perhaps better,' but we may be able to guess which domain
-  #    is correct by comparing the svcnum of domains to the username
-  #    of the svc_acct
-  #
-
-  # The intuitive way:
-
-  my $def_acct = new FS::svc_acct ( { $svc_acct->hash } );
-  $def_acct->setfield('domsvc' => $svc_domain->getfield('svcnum'));
-  $error = $def_acct->replace($svc_acct);
-  die "Error replacing svc_acct for " . $def_acct->username . " : $error" if $error;
-
-  foreach $svc_acct_sm (@svc_acct_sms) {
-
-    my($domrec)=qsearchs('svc_domain', {
-      svcnum => $svc_acct_sm->getfield('domsvc'),
-    }) || die  "svc_acct_sm references invalid domsvc $svc_acct_sm->getfield('domsvc')\n";
-
-    if ($svc_acct_sm->getfield('domuser') =~ /^\*$/) {
-      
-      my($newdom) = new FS::svc_domain ( { $domrec->hash } );
-      $newdom->setfield('catchall', $svc_acct->svcnum);
-      $newdom->setfield('action', "M");
-      $error = $newdom->replace($domrec);
-      die "Error replacing svc_domain for (anything)@" . $domrec->domain . " : $error" if $error;
-
-    } else {
-
-      my($newacct) = new FS::svc_acct {
-        'svcpart'  => $pop_svcpart,
-        'username' => $svc_acct_sm->getfield('domuser'),
-        'domsvc'   => $svc_acct_sm->getfield('domsvc'),
-        'dir'      => '/dev/null',
-      };
-      $error = $newacct->insert;
-      die "Error adding svc_acct for " . $newacct->username . " : $error" if $error;
-     
-      my($newforward) = new FS::svc_forward {
-        'svcpart'  => $forward_svcpart, 
-        'srcsvc'   => $newacct->getfield('svcnum'),
-        'dstsvc'   => $def_acct->getfield('svcnum'),
-      };
-      $error = $newforward->insert;
-      die "Error adding svc_forward for " . $newacct->username ." : $error" if $error;
-    }
-     
-    $error = $svc_acct_sm->delete;
-    die "Error deleting svc_acct_sm for " . $svc_acct_sm->domuser ." : $error" if $error;
-
-  };
-
-};
-
-
-$dbh->commit or die $dbh->errstr;
-$dbh->disconnect or die $dbh->errstr;
-
-print "svc_acct_sm records sucessfully migrated\n";
-
-sub usage {
-  die "Usage:\n  fs-migrate-svc_acct_sm user\n"; 
-}
-
index 4e4769e..ee093b3 100755 (executable)
@@ -1,20 +1,18 @@
 #!/usr/bin/perl -Tw
 
 # quick'n'dirty hack of fs-setup to add radius attributes
 #!/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 strict;
 use DBI;
-use FS::UID qw(adminsuidsetup checkeuid getsecrets);
+use FS::UID qw(adminsuidsetup);
 use FS::raddb;
 
 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;
 my %attrib2db =
   map { lc($FS::raddb::attrib{$_}) => $_ } keys %FS::raddb::attrib;
 
 my $user = shift or die &usage;
-getsecrets($user);
-
 my $dbh = adminsuidsetup $user;
 
 ###
 my $dbh = adminsuidsetup $user;
 
 ###
index 3de0137..c6c24e0 100755 (executable)
@@ -1,20 +1,18 @@
 #!/usr/bin/perl -Tw
 
 # quick'n'dirty hack of fs-setup to add radius attributes
 #!/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 strict;
 use DBI;
-use FS::UID qw(adminsuidsetup checkeuid getsecrets);
+use FS::UID qw(adminsuidsetup);
 use FS::raddb;
 
 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;
 my %attrib2db =
   map { lc($FS::raddb::attrib{$_}) => $_ } keys %FS::raddb::attrib;
 
 my $user = shift or die &usage;
-getsecrets($user);
-
 my $dbh = adminsuidsetup $user;
 
 ###
 my $dbh = adminsuidsetup $user;
 
 ###
index 4dba1e7..09300c6 100755 (executable)
@@ -8,7 +8,6 @@
 <INPUT TYPE="hidden" NAME="paybatch" VALUE="">
 <INPUT TYPE="hidden" NAME="_date" VALUE="<% $_date %>">
 <INPUT TYPE="hidden" NAME="credited" VALUE="">
 <INPUT TYPE="hidden" NAME="paybatch" VALUE="">
 <INPUT TYPE="hidden" NAME="_date" VALUE="<% $_date %>">
 <INPUT TYPE="hidden" NAME="credited" VALUE="">
-<INPUT TYPE="hidden" NAME="otaker" VALUE="<% $otaker %>">
 
 <% ntable("#cccccc", 2) %>
 
 
 <% ntable("#cccccc", 2) %>
 
@@ -74,7 +73,6 @@ die "access denied"
 my $custnum = $cgi->param('custnum');
 my $amount  = $cgi->param('amount');
 my $_date   = time;
 my $custnum = $cgi->param('custnum');
 my $amount  = $cgi->param('amount');
 my $_date   = time;
-my $otaker  = getotaker;
 my $p1      = popurl(1);
 
 </%init>
 my $p1      = popurl(1);
 
 </%init>
index 2908848..d597d0b 100755 (executable)
@@ -299,7 +299,6 @@ if ( $cgi->param('error') ) {
   $cust_main = new FS::cust_main ( {} );
   $cust_main->agentnum( $conf->config('default_agentnum') )
     if $conf->exists('default_agentnum');
   $cust_main = new FS::cust_main ( {} );
   $cust_main->agentnum( $conf->config('default_agentnum') )
     if $conf->exists('default_agentnum');
-  $cust_main->otaker( &getotaker );
   $cust_main->referral_custnum( $cgi->param('referral_custnum') );
   @invoicing_list = ();
   push @invoicing_list, 'POST'
   $cust_main->referral_custnum( $cgi->param('referral_custnum') );
   @invoicing_list = ();
   push @invoicing_list, 'POST'
index 7b1050a..acc3368 100644 (file)
@@ -441,8 +441,6 @@ if ( $cgi->param('error') ) {
   $dst_pkeyvalue = '';
 }
 
   $dst_pkeyvalue = '';
 }
 
-my $otaker = getotaker;
-
 my $p1 = popurl(1);
 
 my $src = qsearchs($src_table, { $src_pkey => $src_pkeyvalue } );
 my $p1 = popurl(1);
 
 my $src = qsearchs($src_table, { $src_pkey => $src_pkeyvalue } );
index 627791b..574fb51 100755 (executable)
@@ -482,8 +482,6 @@ my $action = $svcnum ? 'Edit' : 'Add';
 
 my $svc = $part_svc->getfield('svc');
 
 
 my $svc = $part_svc->getfield('svc');
 
-my $otaker = getotaker;
-
 my $username = $svc_acct->username;
 
 my $password = '';
 my $username = $svc_acct->username;
 
 my $password = '';
index 9319422..dc2cc32 100644 (file)
@@ -185,8 +185,6 @@ my $action = $svcnum ? 'Edit' : 'Add';
 
 my $svc = $part_svc->getfield('svc');
 
 
 my $svc = $part_svc->getfield('svc');
 
-#my $otaker = getotaker;
-
 my $p1 = popurl(1);
 
 my $link_query = "?svcnum=$svcnum;pkgnum=$pkgnum;svcpart=$svcpart";
 my $p1 = popurl(1);
 
 my $link_query = "?svcnum=$svcnum;pkgnum=$pkgnum;svcpart=$svcpart";
index c3307fa..417b1b4 100755 (executable)
@@ -148,8 +148,6 @@ my $export = $exports[0];
 # If we have a domain registration export, get the registrar object
 my $registrar = $export ? $export->registrar : '';
 
 # If we have a domain registration export, get the registrar object
 my $registrar = $export ? $export->registrar : '';
 
-my $otaker = getotaker;
-
 my $domain = $svc_domain->domain;
 
 my $p1 = popurl(1);
 my $domain = $svc_domain->domain;
 
 my $p1 = popurl(1);
index 4f5015e..7a7dc08 100644 (file)
@@ -52,7 +52,7 @@ Example:
         <td align=left BGCOLOR="#ffffff"> <!-- valign="top" -->
           <font size=6><% $company_name || 'ExampleCo' %></font>
         </td>
         <td align=left BGCOLOR="#ffffff"> <!-- valign="top" -->
           <font size=6><% $company_name || 'ExampleCo' %></font>
         </td>
-        <td align=right valign=top BGCOLOR="#ffffff"><FONT SIZE="-1">Logged in as <b><% getotaker %>&nbsp;</b> <FONT SIZE="-2"><a href="<%$fsurl%>loginout/logout.html">logout</a></FONT><br></FONT><FONT SIZE="-2"><a href="<%$fsurl%>pref/pref.html" STYLE="color: #000000">Preferences</a>
+        <td align=right valign=top BGCOLOR="#ffffff"><FONT SIZE="-1">Logged in as <b><% $FS::CurrentUser::CurrentUser->username |h %>&nbsp;</b> <FONT SIZE="-2"><a href="<%$fsurl%>loginout/logout.html">logout</a></FONT><br></FONT><FONT SIZE="-2"><a href="<%$fsurl%>pref/pref.html" STYLE="color: #000000">Preferences</a>
 %         if ( $conf->config("ticket_system")
 %              && FS::TicketSystem->access_right(\%session, 'ModifySelf') ) {
             | <a href="<%$fsurl%>rt/Prefs/Other.html" STYLE="color: #000000">Ticketing preferences</a>
 %         if ( $conf->config("ticket_system")
 %              && FS::TicketSystem->access_right(\%session, 'ModifySelf') ) {
             | <a href="<%$fsurl%>rt/Prefs/Other.html" STYLE="color: #000000">Ticketing preferences</a>
index bc51e6a..d563fa0 100644 (file)
@@ -21,7 +21,7 @@
 %       ORDER BY history_date desc" # LIMIT 10
 %    ) or die dbh->errstr;
 %
 %       ORDER BY history_date desc" # LIMIT 10
 %    ) or die dbh->errstr;
 %
-%  $sth->execute( getotaker() ) or die $sth->errstr;
+%  $sth->execute( $FS::CurrentUser::CurrentUser->username ) or die $sth->errstr;
 %
 %  my %saw = ();
 %  my @custnums = grep { !$saw{$_}++ } map $_->[0], @{ $sth->fetchall_arrayref };
 %
 %  my %saw = ();
 %  my @custnums = grep { !$saw{$_}++ } map $_->[0], @{ $sth->fetchall_arrayref };
index 6b94f71..242e122 100644 (file)
@@ -20,7 +20,8 @@ if ( grep { $cgi->param($_) !~ /^\s*$/ }
    ) {
 
   $access_user = qsearchs( 'access_user', {
    ) {
 
   $access_user = qsearchs( 'access_user', {
-    'username'  => getotaker,
+    'usernum'   => $FS::CurrentUser::CurrentUser->usernum,
+    'username'  => $FS::CurrentUser::CurrentUser->username,
     '_password' => scalar($cgi->param('_password')),
   } );
 
     '_password' => scalar($cgi->param('_password')),
   } );
 
index 5babb01..9861c3f 100644 (file)
@@ -1,4 +1,4 @@
-<% include('/elements/header.html', 'Preferences for '. getotaker ) %>
+<% include('/elements/header.html', 'Preferences for '. $FS::CurrentUser::CurrentUser->username ) %>
 
 <FORM METHOD="POST" NAME="pref_form" ACTION="pref-process.html">
 
 
 <FORM METHOD="POST" NAME="pref_form" ACTION="pref-process.html">