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