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 'default_svc_class' => 'Email',
71 Export accounts (svc_acct records) to SQL databases. Currently has default
72 configurations for vpopmail and Postfix+Courier IMAP but intended to be
73 configurable for other schemas as well.
75 <BR><BR>In contrast to sqlmail, this is intended to export just svc_acct
76 records only, rather than a single export for svc_acct, svc_forward and
77 svc_domain records, to export in "default" database schemas rather than
78 configure the MTA or POP/IMAP server for a Freeside-specific schema, and
79 to be configured for different mail server setups.
81 <BR><BR>Use these buttons for some useful presets:
83 <li><INPUT TYPE="button" VALUE="vpopmail" onClick='
84 this.form.table.value = "vpopmail";
85 this.form.schema.value = "$vpopmail_map";
86 this.form.primary_key.value = "pw_name, pw_domain";
88 <LI><INPUT TYPE="button" VALUE="postfix_courierimap_mailbox" onClick='
89 this.form.table.value = "mailbox";
90 this.form.schema.value = "$postfix_courierimap_mailbox_map";
91 this.form.primary_key.value = "username";
93 <LI><INPUT TYPE="button" VALUE="postfix_courierimap_alias" onClick='
94 this.form.table.value = "alias";
95 this.form.schema.value = "$postfix_courierimap_alias_map";
96 this.form.primary_key.value = "address";
98 <LI><INPUT TYPE="button" VALUE="postfix_native_mailbox" onClick='
99 this.form.table.value = "users";
100 this.form.schema.value = "$postfix_native_mailbox_map";
101 this.form.primary_key.value = "userid";
107 sub _map_arg_callback {
108 my($self, $field) = @_;
109 my $crypt = $self->option('crypt');
110 return () unless $field eq 'crypt_password' && $crypt;