diff options
author | ivan <ivan> | 2002-09-17 09:19:42 +0000 |
---|---|---|
committer | ivan <ivan> | 2002-09-17 09:19:42 +0000 |
commit | 3595c874f8e476e58b98b7ab6d86918d4dbb1d5c (patch) | |
tree | 4d9be30683447ac8412c439b7e55dc12b96bac20 /FS | |
parent | 3999cc30d219a7ebf6db985d0904ffe42b79860e (diff) |
remove svc_acct_sm
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS.pm | 2 | ||||
-rw-r--r-- | FS/FS/InitHandler.pm | 1 | ||||
-rw-r--r-- | FS/FS/cust_pkg.pm | 14 | ||||
-rw-r--r-- | FS/FS/part_export.pm | 2 | ||||
-rw-r--r-- | FS/FS/part_svc.pm | 27 | ||||
-rw-r--r-- | FS/FS/svc_acct.pm | 9 | ||||
-rw-r--r-- | FS/FS/svc_acct_sm.pm | 260 | ||||
-rw-r--r-- | FS/MANIFEST | 2 | ||||
-rw-r--r-- | FS/t/svc_acct_sm.t | 5 |
9 files changed, 9 insertions, 313 deletions
@@ -62,8 +62,6 @@ L<FS::domain_record> - DNS zone entries L<FS::svc_forward> - Mail forwarding class -L<FS::svc_acct_sm> - (Depreciated) Vitual mail alias class - L<FS::svc_www> - Web virtual host class. L<FS::part_svc> - Service definition class diff --git a/FS/FS/InitHandler.pm b/FS/FS/InitHandler.pm index 0216615da..5038cf352 100644 --- a/FS/FS/InitHandler.pm +++ b/FS/FS/InitHandler.pm @@ -52,7 +52,6 @@ sub handler { use FS::session; use FS::svc_acct; use FS::svc_acct_pop; - use FS::svc_acct_sm; use FS::svc_domain; use FS::svc_forward; use FS::svc_www; diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 12508e1aa..0c71435e1 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -14,7 +14,6 @@ use FS::pkg_svc; # setup } # because they load configuraion by setting FS::UID::callback (see TODO) use FS::svc_acct; -use FS::svc_acct_sm; use FS::svc_domain; use FS::svc_www; use FS::svc_forward; @@ -679,7 +678,7 @@ sub order { =head1 VERSION -$Id: cust_pkg.pm,v 1.23 2002-08-26 20:40:55 ivan Exp $ +$Id: cust_pkg.pm,v 1.24 2002-09-17 09:19:06 ivan Exp $ =head1 BUGS @@ -690,11 +689,12 @@ In sub order, the @pkgparts array (passed by reference) is clobbered. Also in sub order, no money is adjusted. Once FS::part_pkg defines a standard method to pass dates to the recur_prog expression, it should do so. -FS::svc_acct, FS::svc_acct_sm, and FS::svc_domain are loaded via 'use' at -compile time, rather than via 'require' in sub { setup, suspend, unsuspend, -cancel } because they use %FS::UID::callback to load configuration values. -Probably need a subroutine which decides what to do based on whether or not -we've fetched the user yet, rather than a hash. See FS::UID and the TODO. +FS::svc_acct, FS::svc_domain, FS::svc_www and FS::svc_forward are loaded via +'use' at compile time, rather than via 'require' in sub +{ setup, suspend, unsuspend, cancel } because they use %FS::UID::callback to +load configuration values. Probably need a subroutine which decides what to +do based on whether or not we've fetched the user yet, rather than a hash. +See FS::UID and the TODO. Now that things are transactional should the check in the insert method be moved to check ? diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm index 69cd8058b..647666b86 100644 --- a/FS/FS/part_export.pm +++ b/FS/FS/part_export.pm @@ -819,8 +819,6 @@ tie my %sqlmail_options, 'Tie::IxHash', }, - 'svc_acct_sm' => {}, - 'svc_forward' => { 'sqlmail' => { 'desc' => 'Real-time export to SQL-backed mail server', diff --git a/FS/FS/part_svc.pm b/FS/FS/part_svc.pm index 959a3f887..7c6acdbcd 100644 --- a/FS/FS/part_svc.pm +++ b/FS/FS/part_svc.pm @@ -254,31 +254,6 @@ sub check { my @fields = eval { fields( $recref->{svcdb} ) }; #might die return "Unknown svcdb!" unless @fields; -##REPLACED BY part_svc_column -# my $svcdb; -# foreach $svcdb ( qw( -# svc_acct svc_acct_sm svc_domain -# ) ) { -# my @rows = map { /^${svcdb}__(.*)$/; $1 } -# grep ! /_flag$/, -# grep /^${svcdb}__/, -# fields('part_svc'); -# foreach my $row (@rows) { -# unless ( $svcdb eq $recref->{svcdb} ) { -# $recref->{$svcdb.'__'.$row}=''; -# $recref->{$svcdb.'__'.$row.'_flag'}=''; -# next; -# } -# $recref->{$svcdb.'__'.$row.'_flag'} =~ /^([DF]?)$/ -# or return "Illegal flag for $svcdb $row"; -# $recref->{$svcdb.'__'.$row.'_flag'} = $1; -# -# my $error = $self->ut_anything($svcdb.'__'.$row); -# return $error if $error; -# -# } -# } - ''; #no error } @@ -325,7 +300,7 @@ sub part_export { =head1 VERSION -$Id: part_svc.pm,v 1.13 2002-04-11 22:05:31 ivan Exp $ +$Id: part_svc.pm,v 1.14 2002-09-17 09:19:06 ivan Exp $ =head1 BUGS diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index f73ab82da..bd348f8ed 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -18,11 +18,9 @@ use FS::UID qw( datasrc ); use FS::Conf; use FS::Record qw( qsearch qsearchs fields dbh ); use FS::svc_Common; -use Net::SSH; use FS::cust_svc; use FS::part_svc; use FS::svc_acct_pop; -use FS::svc_acct_sm; use FS::cust_main_invoice; use FS::svc_domain; use FS::raddb; @@ -410,11 +408,6 @@ The corresponding FS::cust_svc record will be deleted as well. sub delete { my $self = shift; - if ( defined( $FS::Record::dbdef->table('svc_acct_sm') ) ) { - return "Can't delete an account which has (svc_acct_sm) mail aliases!" - if $self->uid && qsearch( 'svc_acct_sm', { 'domuid' => $self->uid } ); - } - return "Can't delete an account which is a (svc_forward) source!" if qsearch( 'svc_forward', { 'srcsvc' => $self->svcnum } ); @@ -1148,7 +1141,7 @@ probably live somewhere else... L<FS::svc_Common>, edit/part_svc.cgi from an installed web interface, export.html from the base documentation, L<FS::Record>, L<FS::Conf>, L<FS::cust_svc>, L<FS::part_svc>, L<FS::cust_pkg>, L<FS::queue>, -L<freeside-queued>), L<Net::SSH>, L<ssh>, L<FS::svc_acct_pop>, +L<freeside-queued>), L<FS::svc_acct_pop>, schema.html from the base documentation. =cut diff --git a/FS/FS/svc_acct_sm.pm b/FS/FS/svc_acct_sm.pm deleted file mode 100644 index c92f1421f..000000000 --- a/FS/FS/svc_acct_sm.pm +++ /dev/null @@ -1,260 +0,0 @@ -package FS::svc_acct_sm; - -use strict; -use vars qw( @ISA $nossh_hack $conf $shellmachine @qmailmachines ); -use FS::Record qw( fields qsearch qsearchs ); -use FS::svc_Common; -use FS::cust_svc; -use Net::SSH qw(ssh); -use FS::Conf; -use FS::svc_acct; -use FS::svc_domain; - -@ISA = qw( FS::svc_Common ); - -#ask FS::UID to run this stuff for us later -#$FS::UID::callback{'FS::svc_acct_sm'} = sub { -# $conf = new FS::Conf; -# $shellmachine = $conf->exists('qmailmachines') -# ? $conf->config('shellmachine') -# : ''; -#}; - -=head1 NAME - -FS::svc_acct_sm - Object methods for svc_acct_sm records - -=head1 SYNOPSIS - - use FS::svc_acct_sm; - - $record = new FS::svc_acct_sm \%hash; - $record = new FS::svc_acct_sm { 'column' => 'value' }; - - $error = $record->insert; - - $error = $new_record->replace($old_record); - - $error = $record->delete; - - $error = $record->check; - - $error = $record->suspend; - - $error = $record->unsuspend; - - $error = $record->cancel; - -=head1 WARNING - -FS::svc_acct_sm is B<depreciated>. This class is only included for migration -purposes. See L<FS::svc_forward>. - -=head1 DESCRIPTION - -An FS::svc_acct_sm object represents a virtual mail alias. FS::svc_acct_sm -inherits from FS::Record. The following fields are currently supported: - -=over 4 - -=item svcnum - primary key (assigned automatcially for new accounts) - -=item domsvc - svcnum of the virtual domain (see L<FS::svc_domain>) - -=item domuid - uid of the target account (see L<FS::svc_acct>) - -=item domuser - virtual username - -=back - -=head1 METHODS - -=over 4 - -=item new HASHREF - -Creates a new virtual mail alias. To add the virtual mail alias to the -database, see L<"insert">. - -=cut - -sub table { 'svc_acct_sm'; } - -=item insert - -Adds this virtual mail alias to the database. If there is an error, returns -the error, otherwise returns false. - -The additional fields pkgnum and svcpart (see L<FS::cust_svc>) should be -defined. An FS::cust_svc record will be created and inserted. - - #If the configuration values (see L<FS::Conf>) shellmachine and qmailmachines - #exist, and domuser is `*' (meaning a catch-all mailbox), the command: - # - # [ -e $dir/.qmail-$qdomain-default ] || { - # touch $dir/.qmail-$qdomain-default; - # chown $uid:$gid $dir/.qmail-$qdomain-default; - # } - # - #is executed on shellmachine via ssh (see L<dot-qmail/"EXTENSION ADDRESSES">). - #This behaviour can be surpressed by setting $FS::svc_acct_sm::nossh_hack true. - -=cut - -sub insert { - my $self = shift; - my $error; - - local $SIG{HUP} = 'IGNORE'; - local $SIG{INT} = 'IGNORE'; - local $SIG{QUIT} = 'IGNORE'; - local $SIG{TERM} = 'IGNORE'; - local $SIG{TSTP} = 'IGNORE'; - local $SIG{PIPE} = 'IGNORE'; - - $error=$self->check; - return $error if $error; - - return "Domain username (domuser) in use for this domain (domsvc)" - if qsearchs('svc_acct_sm',{ 'domuser'=> $self->domuser, - 'domsvc' => $self->domsvc, - } ); - - return "First domain username (domuser) for domain (domsvc) must be " . - qq='*' (catch-all)!= - if $self->domuser ne '*' - && ! qsearch('svc_acct_sm',{ 'domsvc' => $self->domsvc } ) - && ! $conf->exists('maildisablecatchall'); - - $error = $self->SUPER::insert; - return $error if $error; - - #my $svc_domain = qsearchs( 'svc_domain', { 'svcnum' => $self->domsvc } ); - #my $svc_acct = qsearchs( 'svc_acct', { 'uid' => $self->domuid } ); - #my ( $uid, $gid, $dir, $domain ) = ( - # $svc_acct->uid, - # $svc_acct->gid, - # $svc_acct->dir, - # $svc_domain->domain, - #); - #my $qdomain = $domain; - #$qdomain =~ s/\./:/g; #see manpage for 'dot-qmail': EXTENSION ADDRESSES - #ssh("root\@$shellmachine","[ -e $dir/.qmail-$qdomain-default ] || { touch $dir/.qmail-$qdomain-default; chown $uid:$gid $dir/.qmail-$qdomain-default; }") - # if ( ! $nossh_hack && $shellmachine && $dir && $self->domuser eq '*' ); - - ''; #no error - -} - -=item delete - -Deletes this virtual mail alias from the database. If there is an error, -returns the error, otherwise returns false. - -The corresponding FS::cust_svc record will be deleted as well. - -=item replace OLD_RECORD - -Replaces OLD_RECORD with this one in the database. If there is an error, -returns the error, otherwise returns false. - -=cut - -sub replace { - my ( $new, $old ) = ( shift, shift ); - my $error; - - return "Domain username (domuser) in use for this domain (domsvc)" - if ( $old->domuser ne $new->domuser - || $old->domsvc != $new->domsvc - ) && qsearchs('svc_acct_sm',{ - 'domuser'=> $new->domuser, - 'domsvc' => $new->domsvc, - } ) - ; - - $new->SUPER::replace($old); - -} - -=item suspend - -Just returns false (no error) for now. - -Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>). - -=item unsuspend - -Just returns false (no error) for now. - -Called by the unsuspend method of FS::cust_pkg (see L<FS::cust_pkg>). - -=item cancel - -Just returns false (no error) for now. - -Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>). - -=item check - -Checks all fields to make sure this is a valid virtual mail alias. If there is -an error, returns the error, otherwise returns false. Called by the insert and -replace methods. - -Sets any fixed values; see L<FS::part_svc>. - -=cut - -sub check { - my $self = shift; - my $error; - - my $x = $self->setfixed; - return $x unless ref($x); - #my $part_svc = $x; - - my($recref) = $self->hashref; - - $recref->{domuser} =~ /^(\*|[a-z0-9_\-]{2,32})$/ - or return "Illegal domain username (domuser)"; - $recref->{domuser} = $1; - - $recref->{domsvc} =~ /^(\d+)$/ or return "Illegal domsvc"; - $recref->{domsvc} = $1; - my($svc_domain); - return "Unknown domsvc" unless - $svc_domain=qsearchs('svc_domain',{'svcnum'=> $recref->{domsvc} } ); - - $recref->{domuid} =~ /^(\d+)$/ or return "Illegal uid"; - $recref->{domuid} = $1; - my($svc_acct); - return "Unknown uid" unless - $svc_acct=qsearchs('svc_acct',{'uid'=> $recref->{domuid} } ); - - ''; #no error -} - -=back - -=head1 VERSION - -$Id: svc_acct_sm.pm,v 1.5 2001-09-06 20:41:59 ivan Exp $ - -=head1 BUGS - -The remote commands should be configurable. - -The $recref stuff in sub check should be cleaned up. - -=head1 SEE ALSO - -L<FS::svc_forward> - -L<FS::Record>, L<FS::Conf>, L<FS::cust_svc>, L<FS::part_svc>, L<FS::cust_pkg>, -L<FS::svc_acct>, L<FS::svc_domain>, L<Net::SSH>, L<ssh>, L<dot-qmail>, -schema.html from the base documentation. - -=cut - -1; - diff --git a/FS/MANIFEST b/FS/MANIFEST index 4a250d77b..3cf4c2ba3 100644 --- a/FS/MANIFEST +++ b/FS/MANIFEST @@ -87,7 +87,6 @@ FS/pkg_svc.pm FS/svc_Common.pm FS/svc_acct.pm FS/svc_acct_pop.pm -FS/svc_acct_sm.pm FS/svc_broadband.pm FS/svc_domain.pm FS/type_pkgs.pm @@ -165,7 +164,6 @@ t/radius_usergroup.t t/session.t t/svc_acct.t t/svc_acct_pop.t -t/svc_acct_sm.t t/svc_Common.t t/svc_domain.t t/svc_forward.t diff --git a/FS/t/svc_acct_sm.t b/FS/t/svc_acct_sm.t deleted file mode 100644 index 1082f2cdb..000000000 --- a/FS/t/svc_acct_sm.t +++ /dev/null @@ -1,5 +0,0 @@ -BEGIN { $| = 1; print "1..1\n" } -END {print "not ok 1\n" unless $loaded;} -use FS::svc_acct_sm; -$loaded=1; -print "ok 1\n"; |