[freeside-commits] branch 21563 updated. 9d35792778885932c09102bd011b518eb47c5131

Ivan ivan at 420.am
Mon May 6 23:13:15 PDT 2013


The branch, 21563 has been updated
       via  9d35792778885932c09102bd011b518eb47c5131 (commit)
       via  5c898c621e1343f8c116a75ca3131eb78229e09b (commit)
      from  e62544064299324ab04abae64cc33afef12a24aa (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 9d35792778885932c09102bd011b518eb47c5131
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon May 6 23:13:11 2013 -0700

    NG auth: fix new customer, remove mapsecrets support, RT#21563

diff --git a/FS/FS/Mason.pm b/FS/FS/Mason.pm
index ae75539..43e9b06 100644
--- a/FS/FS/Mason.pm
+++ b/FS/FS/Mason.pm
@@ -126,7 +126,7 @@ if ( -e $addl_handler_use_file ) {
   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
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index 42af68c..a868d48 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -18,7 +18,7 @@ use Text::CSV_XS;
 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;
@@ -1901,7 +1901,11 @@ sub _h_statement {
   "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;
-# 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 } );
diff --git a/FS/FS/UI/Web.pm b/FS/FS/UI/Web.pm
index 7926808..c11e6c9 100644
--- a/FS/FS/UI/Web.pm
+++ b/FS/FS/UI/Web.pm
@@ -579,7 +579,7 @@ use Carp;
 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);
@@ -653,7 +653,7 @@ sub start_job {
       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 {
diff --git a/FS/FS/UID.pm b/FS/FS/UID.pm
index 6596a98..9c52f08 100644
--- a/FS/FS/UID.pm
+++ b/FS/FS/UID.pm
@@ -2,7 +2,7 @@ package FS::UID;
 
 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
 );
@@ -38,7 +38,7 @@ FS::UID - Subroutines for database login and assorted other stuff
 
 =head1 SYNOPSIS
 
-  use FS::UID qw(adminsuidsetup dbh datasrc getotaker checkeuid checkruid);
+  use FS::UID qw(adminsuidsetup dbh datasrc checkeuid checkruid);
 
   $dbh = adminsuidsetup $user;
 
@@ -73,7 +73,7 @@ sub adminsuidsetup {
 }
 
 sub forksuidsetup {
-  $user = shift;
+  my $user = shift;
   my $olduser = $user;
   warn "$me forksuidsetup starting for $user\n" if $DEBUG;
 
@@ -173,12 +173,12 @@ sub callback_setup {
 }
 
 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";
 
@@ -276,12 +276,13 @@ sub suidsetup {
 
 =item getotaker
 
-Returns the current Freeside user.
+(Deprecated) Returns the current Freeside user's username.
 
 =cut
 
 sub getotaker {
-  $user;
+  carp "FS::UID::getotaker deprecated";
+  $FS::CurrentUser::CurrentUser->username;
 }
 
 =item checkeuid
@@ -305,34 +306,18 @@ sub checkruid {
   ( $< == $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 {
-  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) = 
-    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);
diff --git a/FS/FS/banned_pay.pm b/FS/FS/banned_pay.pm
index b93f67b..713c81a 100644
--- a/FS/FS/banned_pay.pm
+++ b/FS/FS/banned_pay.pm
@@ -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 FS::UID qw( getotaker );
 use FS::CurrentUser;
 
 =head1 NAME
diff --git a/FS/FS/cust_credit.pm b/FS/FS/cust_credit.pm
index ba279a2..0376f1d 100644
--- a/FS/FS/cust_credit.pm
+++ b/FS/FS/cust_credit.pm
@@ -7,7 +7,7 @@ use vars qw( $conf $unsuspendauto $me $DEBUG
            );
 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;
diff --git a/FS/FS/cust_credit_bill.pm b/FS/FS/cust_credit_bill.pm
index 900a5c0..9ecb7e0 100644
--- a/FS/FS/cust_credit_bill.pm
+++ b/FS/FS/cust_credit_bill.pm
@@ -2,7 +2,6 @@ package FS::cust_credit_bill;
 
 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;
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 2a4602e..3c0702f 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -32,7 +32,7 @@ use Date::Format;
 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);
diff --git a/FS/FS/cust_main/Status.pm b/FS/FS/cust_main/Status.pm
index e5803e0..f84ff0f 100644
--- a/FS/FS/cust_main/Status.pm
+++ b/FS/FS/cust_main/Status.pm
@@ -2,13 +2,10 @@ package FS::cust_main::Status;
 
 use strict;
 use vars qw( $conf ); # $module ); #$DEBUG $me );
+use Tie::IxHash;
 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]';
 
diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm
index 6d09f89..4491f78 100644
--- a/FS/FS/cust_pay.pm
+++ b/FS/FS/cust_pay.pm
@@ -9,7 +9,6 @@ use vars qw( $DEBUG $me $conf @encrypted_fields
 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;
diff --git a/FS/FS/cust_pay_refund.pm b/FS/FS/cust_pay_refund.pm
index cb9dbce..b799f69 100644
--- a/FS/FS/cust_pay_refund.pm
+++ b/FS/FS/cust_pay_refund.pm
@@ -2,7 +2,6 @@ package FS::cust_pay_refund;
 
 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;
diff --git a/FS/FS/cust_pay_void.pm b/FS/FS/cust_pay_void.pm
index 42fc296..92a96cb 100644
--- a/FS/FS/cust_pay_void.pm
+++ b/FS/FS/cust_pay_void.pm
@@ -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;
-use FS::UID qw(getotaker);
 use FS::Record qw(qsearch qsearchs dbh fields);
 use FS::CurrentUser;
 use FS::access_user;
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 374cf7a..19337c4 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -10,7 +10,7 @@ use List::Util qw(min max);
 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;
diff --git a/FS/FS/cust_refund.pm b/FS/FS/cust_refund.pm
index 45a170b..0649929 100644
--- a/FS/FS/cust_refund.pm
+++ b/FS/FS/cust_refund.pm
@@ -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;
-use FS::UID qw(getotaker);
 use FS::Record qw( qsearch qsearchs dbh );
 use FS::CurrentUser;
 use FS::cust_credit;
diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup
index 155c74a..07da88d 100755
--- a/FS/bin/freeside-setup
+++ b/FS/bin/freeside-setup
@@ -32,7 +32,7 @@ $config_dir =~ /^([\w.:=\/]+)$/
   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;
diff --git a/FS/bin/freeside-upgrade b/FS/bin/freeside-upgrade
index b08a840..399c119 100755
--- a/FS/bin/freeside-upgrade
+++ b/FS/bin/freeside-upgrade
@@ -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 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);
diff --git a/bin/fs-migrate-svc_acct_sm b/bin/fs-migrate-svc_acct_sm
deleted file mode 100755
index 07f7b61..0000000
--- a/bin/fs-migrate-svc_acct_sm
+++ /dev/null
@@ -1,227 +0,0 @@
-#!/usr/bin/perl -Tw
-#
-# jeff at 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"; 
-}
-
diff --git a/bin/fs-radius-add-check b/bin/fs-radius-add-check
index 4e4769e..ee093b3 100755
--- a/bin/fs-radius-add-check
+++ b/bin/fs-radius-add-check
@@ -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;
 
 ###
diff --git a/bin/fs-radius-add-reply b/bin/fs-radius-add-reply
index 3de0137..c6c24e0 100755
--- a/bin/fs-radius-add-reply
+++ b/bin/fs-radius-add-reply
@@ -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;
 
 ###
diff --git a/httemplate/edit/cust_credit.cgi b/httemplate/edit/cust_credit.cgi
index 4dba1e7..09300c6 100755
--- a/httemplate/edit/cust_credit.cgi
+++ b/httemplate/edit/cust_credit.cgi
@@ -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="otaker" VALUE="<% $otaker %>">
 
 <% ntable("#cccccc", 2) %>
 
@@ -74,7 +73,6 @@ die "access denied"
 my $custnum = $cgi->param('custnum');
 my $amount  = $cgi->param('amount');
 my $_date   = time;
-my $otaker  = getotaker;
 my $p1      = popurl(1);
 
 </%init>
diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi
index 2908848..d597d0b 100755
--- a/httemplate/edit/cust_main.cgi
+++ b/httemplate/edit/cust_main.cgi
@@ -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->otaker( &getotaker );
   $cust_main->referral_custnum( $cgi->param('referral_custnum') );
   @invoicing_list = ();
   push @invoicing_list, 'POST'
diff --git a/httemplate/edit/elements/ApplicationCommon.html b/httemplate/edit/elements/ApplicationCommon.html
index 7b1050a..acc3368 100644
--- a/httemplate/edit/elements/ApplicationCommon.html
+++ b/httemplate/edit/elements/ApplicationCommon.html
@@ -441,8 +441,6 @@ if ( $cgi->param('error') ) {
   $dst_pkeyvalue = '';
 }
 
-my $otaker = getotaker;
-
 my $p1 = popurl(1);
 
 my $src = qsearchs($src_table, { $src_pkey => $src_pkeyvalue } );
diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi
index 627791b..574fb51 100755
--- a/httemplate/edit/svc_acct.cgi
+++ b/httemplate/edit/svc_acct.cgi
@@ -482,8 +482,6 @@ my $action = $svcnum ? 'Edit' : 'Add';
 
 my $svc = $part_svc->getfield('svc');
 
-my $otaker = getotaker;
-
 my $username = $svc_acct->username;
 
 my $password = '';
diff --git a/httemplate/edit/svc_cert.cgi b/httemplate/edit/svc_cert.cgi
index 9319422..dc2cc32 100644
--- a/httemplate/edit/svc_cert.cgi
+++ b/httemplate/edit/svc_cert.cgi
@@ -185,8 +185,6 @@ my $action = $svcnum ? 'Edit' : 'Add';
 
 my $svc = $part_svc->getfield('svc');
 
-#my $otaker = getotaker;
-
 my $p1 = popurl(1);
 
 my $link_query = "?svcnum=$svcnum;pkgnum=$pkgnum;svcpart=$svcpart";
diff --git a/httemplate/edit/svc_domain.cgi b/httemplate/edit/svc_domain.cgi
index c3307fa..417b1b4 100755
--- a/httemplate/edit/svc_domain.cgi
+++ b/httemplate/edit/svc_domain.cgi
@@ -148,8 +148,6 @@ my $export = $exports[0];
 # 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);
diff --git a/httemplate/elements/header.html b/httemplate/elements/header.html
index 4f5015e..7a7dc08 100644
--- a/httemplate/elements/header.html
+++ b/httemplate/elements/header.html
@@ -52,7 +52,7 @@ Example:
         <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 %> </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 %> </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>
diff --git a/httemplate/index.html b/httemplate/index.html
index bc51e6a..d563fa0 100644
--- a/httemplate/index.html
+++ b/httemplate/index.html
@@ -21,7 +21,7 @@
 %       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 };
diff --git a/httemplate/pref/pref-process.html b/httemplate/pref/pref-process.html
index 6b94f71..242e122 100644
--- a/httemplate/pref/pref-process.html
+++ b/httemplate/pref/pref-process.html
@@ -20,7 +20,8 @@ if ( grep { $cgi->param($_) !~ /^\s*$/ }
    ) {
 
   $access_user = qsearchs( 'access_user', {
-    'username'  => getotaker,
+    'usernum'   => $FS::CurrentUser::CurrentUser->usernum,
+    'username'  => $FS::CurrentUser::CurrentUser->username,
     '_password' => scalar($cgi->param('_password')),
   } );
 
diff --git a/httemplate/pref/pref.html b/httemplate/pref/pref.html
index 5babb01..9861c3f 100644
--- a/httemplate/pref/pref.html
+++ b/httemplate/pref/pref.html
@@ -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">
 

commit 5c898c621e1343f8c116a75ca3131eb78229e09b
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon May 6 22:20:40 2013 -0700

    fix login css for all paths, RT#21563

diff --git a/httemplate/loginout/login.html b/httemplate/loginout/login.html
index a67ea4b..d06d0a8 100644
--- a/httemplate/loginout/login.html
+++ b/httemplate/loginout/login.html
@@ -50,8 +50,7 @@ my $error = # $cgi->param('logout') ||
 $error = exists($error{$error}) ? $error{$error} : $error;
 
 
-#my $url_string = CGI->new->url;
-my $url_string = $cgi->url;
+my $url_string = $r->uri;
 
 #fake a freeside path for /login so we get our .css.  shrug
 $url_string =~ s/login$/freeside\/login/ unless $url_string =~ /freeside\//;

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

Summary of changes:
 FS/FS/Mason.pm                                  |    2 +-
 FS/FS/Record.pm                                 |   13 +-
 FS/FS/UI/Web.pm                                 |    4 +-
 FS/FS/UID.pm                                    |   49 ++----
 FS/FS/banned_pay.pm                             |    1 -
 FS/FS/cust_credit.pm                            |    2 +-
 FS/FS/cust_credit_bill.pm                       |    1 -
 FS/FS/cust_main.pm                              |    2 +-
 FS/FS/cust_main/Status.pm                       |    5 +-
 FS/FS/cust_pay.pm                               |    1 -
 FS/FS/cust_pay_refund.pm                        |    1 -
 FS/FS/cust_pay_void.pm                          |    1 -
 FS/FS/cust_pkg.pm                               |    2 +-
 FS/FS/cust_refund.pm                            |    1 -
 FS/bin/freeside-setup                           |    2 +-
 FS/bin/freeside-upgrade                         |    2 +-
 bin/fs-migrate-svc_acct_sm                      |  227 -----------------------
 bin/fs-radius-add-check                         |    8 +-
 bin/fs-radius-add-reply                         |    8 +-
 httemplate/edit/cust_credit.cgi                 |    2 -
 httemplate/edit/cust_main.cgi                   |    1 -
 httemplate/edit/elements/ApplicationCommon.html |    2 -
 httemplate/edit/svc_acct.cgi                    |    2 -
 httemplate/edit/svc_cert.cgi                    |    2 -
 httemplate/edit/svc_domain.cgi                  |    2 -
 httemplate/elements/header.html                 |    2 +-
 httemplate/index.html                           |    2 +-
 httemplate/loginout/login.html                  |    3 +-
 httemplate/pref/pref-process.html               |    3 +-
 httemplate/pref/pref.html                       |    2 +-
 30 files changed, 44 insertions(+), 311 deletions(-)
 delete mode 100755 bin/fs-migrate-svc_acct_sm




More information about the freeside-commits mailing list