use FS::part_export;
use FS::svc_acct;
use FS::export_svc;
-use Carp qw( cluck );
+use Carp qw( carp cluck );
use NEXT;
use Net::OpenSSH;
+use FS::DBI;
@ISA = qw(FS::part_export);
@EXPORT_OK = qw( sqlradius_connect );
}
sub sqlradius_insert { #subroutine, not method
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_insert() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my( $table, $username, %attributes ) = @_;
}
sub sqlradius_usergroup_insert { #subroutine, not method
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_usergroup_insert() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my $username = shift;
my $usergroup = ( $_[0] =~ /^(rad)?usergroup/i ) ? shift : 'usergroup';
}
sub sqlradius_usergroup_delete { #subroutine, not method
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_usergroup_delete() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my $username = shift;
my $usergroup = ( $_[0] =~ /^(rad)?usergroup/i ) ? shift : 'usergroup';
}
sub sqlradius_rename { #subroutine, not method
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_rename() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my($new_username, $old_username) = (shift, shift);
my $usergroup = ( $_[0] =~ /^(rad)?usergroup/i ) ? shift : 'usergroup';
}
sub sqlradius_attrib_delete { #subroutine, not method
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_attrib_delete() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my( $table, $username, @attrib ) = @_;
}
sub sqlradius_delete { #subroutine, not method
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_delete() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my $username = shift;
my $usergroup = ( $_[0] =~ /^(rad)?usergroup/i ) ? shift : 'usergroup';
sub sqlradius_connect {
#my($datasrc, $username, $password) = @_;
#DBI->connect($datasrc, $username, $password) or die $DBI::errstr;
- DBI->connect(@_) or die $DBI::errstr;
+ FS::DBI->connect(@_) or die $FS::DBI::errstr;
}
# on success, returns '' in scalar context, ('',$jobnum) in list context
sub update_svc {
my $self = shift;
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'update_svc() suppressed by noexport_hack'
+ if $self->option('debug') || $DEBUG;
+ return;
+ }
+
my $conf = new FS::Conf;
my $fdbh = dbh;
sub export_nas_action {
my $self = shift;
my ($action, $new, $old) = @_;
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp "export_nas_action($action) suppressed by noexport_hack"
+ if $self->option('debug') || $DEBUG;
+ return;
+ }
+
# find the NAS in the target table by its name
my $nasname = ($action eq 'replace') ? $old->nasname : $new->nasname;
my $nasnum = $new->nasnum;
}
sub sqlradius_nas_insert {
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_nas_insert() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my %opt = @_;
my $nas = qsearchs('nas', { nasnum => $opt{'nasnum'} })
}
sub sqlradius_nas_delete {
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_nas_delete() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my %opt = @_;
my $sth = $dbh->prepare('DELETE FROM nas WHERE nasname = ?');
}
sub sqlradius_nas_replace {
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_nas_replace() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my %opt = @_;
my $nas = qsearchs('nas', { nasnum => $opt{'nasnum'} })
}
sub sqlradius_attr_insert {
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_attr_insert() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my %opt = @_;
}
sub sqlradius_attr_delete {
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_attr_delete() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my %opt = @_;
}
sub sqlradius_group_replace {
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_group_replace() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my $usergroup = shift;
$usergroup =~ /^(rad)?usergroup$/
=cut
sub sqlradius_user_disconnect {
+
+ if ( $FS::svc_Common::noexport_hack ) {
+ carp 'sqlradius_user_disconnect() suppressed by noexport_hack' if $DEBUG;
+ return;
+ }
+
my $dbh = sqlradius_connect(shift, shift, shift);
my %opt = @_;
# get list of nas
sub import_attrs {
my $self = shift;
- my $dbh = DBI->connect( map $self->option($_),
+ my $dbh = FS::DBI->connect( map $self->option($_),
qw( datasrc username password ) );
unless ( $dbh ) {
- warn "Error connecting to RADIUS server: $DBI::errstr\n";
+ warn "Error connecting to RADIUS server: $FS::DBI::errstr\n";
return;
}