freeside/FS/FS/part_export acct_sql.pm,1.7,1.8

ivan ivan at pouncequick.420.am
Tue Apr 19 23:41:45 PDT 2005


Update of /home/cvs/cvsroot/freeside/FS/FS/part_export
In directory pouncequick:/tmp/cvs-serv24208/FS/FS/part_export

Modified Files:
	acct_sql.pm 
Log Message:
add vpopmail defaults to acct_sql export

Index: acct_sql.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/acct_sql.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- acct_sql.pm	11 Dec 2004 23:16:10 -0000	1.7
+++ acct_sql.pm	20 Apr 2005 06:41:39 -0000	1.8
@@ -18,8 +18,24 @@
                             type  => 'textarea',
                           },
   'primary_key'        => { label => 'Database primary key' },
+  'crypt'              => { label => 'Password encryption',
+                            type=>'select', options=>[qw(crypt md5)],
+                            default=>'crypt',
+                          },
 ;
 
+tie my %vpopmail_map, 'Tie::IxHash',
+  'pw_name'   => 'username',
+  'pw_domain' => 'domain',
+  'pw_passwd' => 'crypt_password',
+  'pw_uid'    => 'uid',
+  'pw_gid'    => 'gid',
+  'pw_gecos'  => 'finger',
+  'pw_dir'    => 'dir',
+  'pw_shell'  => 'shell',
+;
+my $vpopmail_map = join('\n', map "$_ $vpopmail_map{$_}", keys %vpopmail_map );
+
 tie my %postfix_courierimap_mailbox_map, 'Tie::IxHash',
   'username' => 'email',
   'password' => '_password',
@@ -46,23 +62,27 @@
 %info = (
   'svc'      => 'svc_acct',
   'desc'     => 'Real-time export of accounts to SQL databases '.
-                '(Postfix+Courier IMAP, others?)',
+                '(vpopmail, Postfix+Courier IMAP, others?)',
   'options'  => \%options,
   'nodomain' => '',
   'notes'    => <<END
-Export accounts (svc_acct records) to SQL databases.  Written for
-Postfix+Courier IMAP but intended to be generally useful for generic SQL
-exports, eventually.
+Export accounts (svc_acct records) to SQL databases.  Currently has default
+configurations for vpopmail and Postfix+Courier IMAP but intended to be
+configurable for other schemas as well.
 
-<BR><BR>In contrast to sqlmail, this is newer and less well tested, and
-currently less flexible.  It is intended to export just svc_acct records only,
-rather than a single export for svc_acct, svc_forward and svc_domain records,
-to export in "default" formats rather than configure the MTA or POP/IMAP server
-for a Freeside-specific schema, and possibly to be configured for different
-mail server setups through some subclassing rather than options.
+<BR><BR>In contrast to sqlmail, this is intended to export just svc_acct
+records only, rather than a single export for svc_acct, svc_forward and
+svc_domain records, to export in "default" database schemas rather than
+configure the MTA or POP/IMAP server for a Freeside-specific schema, and
+to be configured for different mail server setups.
 
 <BR><BR>Use these buttons for some useful presets:
 <UL>
+  <li><INPUT TYPE="button" VALUE="vpopmail" onClick='
+    this.form.table.value = "vpopmail";
+    this.form.schema.value = "$vpopmail_map";
+    this.form.primary_key.value = "pw_name, pw_domain";
+  '>
   <LI><INPUT TYPE="button" VALUE="postfix_courierimap_mailbox" onClick='
     this.form.table.value = "mailbox";
     this.form.schema.value = "$postfix_courierimap_mailbox_map";
@@ -90,7 +110,10 @@
   my %map = $self->_map;
 
   my %record = map { my $value = $map{$_};
-                     $_ => $svc_acct->$value();
+                     my @arg = ();
+                     push @arg, $self->option('crypt')
+                       if $_ eq 'crypt_password' && $self->option('crypt');
+                     $_ => $svc_acct->$value(@arg);
                    } keys %map;
 
   my $err_or_queue =
@@ -113,7 +136,10 @@
   my $keymap = $map{$self->option('primary_key')};
 
   my %record = map { my $value = $map{$_};
-                     $_ => $new->$value();
+                     my @arg = ();
+                     push @arg, $self->option('crypt')
+                       if $_ eq 'crypt_password' && $self->option('crypt');
+                     $_ => $new->$value(@arg);
                    } keys %map;
 
   my $err_or_queue = $self->acct_sql_queue(




More information about the freeside-commits mailing list