1 package FS::part_export::acct_sql;
2 use base qw( FS::part_export::sql_Common );
6 use FS::Record; #qw(qsearchs);
8 my $options = __PACKAGE__->sql_options;
9 $options->{'crypt'} = { label => 'Password encryption',
10 type=>'select', options=>[qw(crypt md5 sha1_base64)],
14 tie my %vpopmail_map, 'Tie::IxHash',
15 'pw_name' => 'username',
16 'pw_domain' => 'domain',
17 'pw_passwd' => 'crypt_password',
20 'pw_gecos' => 'finger',
22 #'pw_shell' => 'shell',
23 'pw_shell' => 'quota',
25 my $vpopmail_map = join('\n', map "$_ $vpopmail_map{$_}", keys %vpopmail_map );
27 tie my %postfix_courierimap_mailbox_map, 'Tie::IxHash',
28 'username' => 'email',
29 'password' => '_password',
30 'crypt' => 'crypt_password',
32 'maildir' => 'virtual_maildir',
36 my $postfix_courierimap_mailbox_map =
37 join('\n', map "$_ $postfix_courierimap_mailbox_map{$_}",
38 keys %postfix_courierimap_mailbox_map );
40 tie my %postfix_courierimap_alias_map, 'Tie::IxHash',
46 my $postfix_courierimap_alias_map =
47 join('\n', map "$_ $postfix_courierimap_alias_map{$_}",
48 keys %postfix_courierimap_alias_map );
50 tie my %postfix_native_mailbox_map, 'Tie::IxHash',
54 'password' => 'ldap_password',
55 'mail' => 'domain_slash_username',
57 my $postfix_native_mailbox_map =
58 join('\n', map "$_ $postfix_native_mailbox_map{$_}",
59 keys %postfix_native_mailbox_map );
63 'desc' => 'Real-time export of accounts to SQL databases '.
64 '(vpopmail, Postfix+Courier IMAP, others?)',
65 'options' => $options,
68 Export accounts (svc_acct records) to SQL databases. Currently has default
69 configurations for vpopmail and Postfix+Courier IMAP but intended to be
70 configurable for other schemas as well.
72 <BR><BR>In contrast to sqlmail, this is intended to export just svc_acct
73 records only, rather than a single export for svc_acct, svc_forward and
74 svc_domain records, to export in "default" database schemas rather than
75 configure the MTA or POP/IMAP server for a Freeside-specific schema, and
76 to be configured for different mail server setups.
78 <BR><BR>Use these buttons for some useful presets:
80 <li><INPUT TYPE="button" VALUE="vpopmail" onClick='
81 this.form.table.value = "vpopmail";
82 this.form.schema.value = "$vpopmail_map";
83 this.form.primary_key.value = "pw_name, pw_domain";
85 <LI><INPUT TYPE="button" VALUE="postfix_courierimap_mailbox" onClick='
86 this.form.table.value = "mailbox";
87 this.form.schema.value = "$postfix_courierimap_mailbox_map";
88 this.form.primary_key.value = "username";
90 <LI><INPUT TYPE="button" VALUE="postfix_courierimap_alias" onClick='
91 this.form.table.value = "alias";
92 this.form.schema.value = "$postfix_courierimap_alias_map";
93 this.form.primary_key.value = "address";
95 <LI><INPUT TYPE="button" VALUE="postfix_native_mailbox" onClick='
96 this.form.table.value = "users";
97 this.form.schema.value = "$postfix_native_mailbox_map";
98 this.form.primary_key.value = "userid";
104 sub _map_arg_callback {
105 my($self, $field) = @_;
106 my $crypt = $self->option('crypt');
107 return () unless $field eq 'crypt_password' && $crypt;