Skip to content

Commit 429dcfd

Browse files
committed
Implemented: FS#278 - Add a configuration option for relay_recipient_maps in mail module.
1 parent 51bedad commit 429dcfd

15 files changed

+475
-0
lines changed

install/dist/lib/fedora.lib.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ function configure_postfix($options = '')
6666

6767
//* mysql-virtual_relaydomains.cf
6868
$this->process_postfix_config('mysql-virtual_relaydomains.cf');
69+
70+
//* mysql-virtual_relayrecipientmaps.cf
71+
$this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf');
6972

7073
//* Changing mode and group of the new created config files.
7174
caselog('chmod o= '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
@@ -101,6 +104,7 @@ function configure_postfix($options = '')
101104
'smtpd_tls_key_file = '.$config_dir.'/smtpd.key',
102105
'transport_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf',
103106
'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf',
107+
'relay_recipient_maps = mysql:'.$config_dir.'/mysql-virtual_relayrecipientmaps.cf',
104108
'virtual_create_maildirsize = yes',
105109
'virtual_maildir_extended = yes',
106110
'virtual_mailbox_limit_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailbox_limit_maps.cf',

install/dist/lib/opensuse.lib.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ function configure_postfix($options = '')
6666

6767
//* mysql-virtual_relaydomains.cf
6868
$this->process_postfix_config('mysql-virtual_relaydomains.cf');
69+
70+
//* mysql-virtual_relayrecipientmaps.cf
71+
$this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf');
6972

7073
//* Changing mode and group of the new created config files.
7174
caselog('chmod o= '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
@@ -101,6 +104,7 @@ function configure_postfix($options = '')
101104
'smtpd_tls_key_file = '.$config_dir.'/smtpd.key',
102105
'transport_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf',
103106
'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf',
107+
'relay_recipient_maps = mysql:'.$config_dir.'/mysql-virtual_relayrecipientmaps.cf',
104108
'virtual_create_maildirsize = yes',
105109
'virtual_maildir_extended = yes',
106110
'virtual_mailbox_limit_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailbox_limit_maps.cf',

install/lib/installer_base.lib.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,9 @@ public function configure_postfix($options = '')
425425

426426
//* mysql-virtual_relaydomains.cf
427427
$this->process_postfix_config('mysql-virtual_relaydomains.cf');
428+
429+
//* mysql-virtual_relayrecipientmaps.cf
430+
$this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf');
428431

429432
//* Changing mode and group of the new created config files.
430433
caselog('chmod o= '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
@@ -460,6 +463,7 @@ public function configure_postfix($options = '')
460463
'smtpd_tls_key_file = '.$config_dir.'/smtpd.key',
461464
'transport_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf',
462465
'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf',
466+
'relay_recipient_maps = mysql:'.$config_dir.'/mysql-virtual_relayrecipientmaps.cf',
463467
'virtual_create_maildirsize = yes',
464468
'virtual_maildir_extended = yes',
465469
'virtual_mailbox_limit_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailbox_limit_maps.cf',

install/sql/ispconfig3.sql

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,26 @@ CREATE TABLE `mail_mailman_domain` (
459459
PRIMARY KEY (`mailman_id`,`server_id`,`domain`)
460460
) ENGINE=MyISAM AUTO_INCREMENT=1;
461461

462+
-- --------------------------------------------------------
463+
464+
--
465+
-- Table structure for Table `mail_relay_recipient`
466+
--
467+
468+
CREATE TABLE IF NOT EXISTS `mail_relay_recipient` (
469+
`relay_recipient_id` bigint(20) NOT NULL AUTO_INCREMENT,
470+
`sys_userid` int(11) NOT NULL DEFAULT '0',
471+
`sys_groupid` int(11) NOT NULL DEFAULT '0',
472+
`sys_perm_user` varchar(5) DEFAULT NULL,
473+
`sys_perm_group` varchar(5) DEFAULT NULL,
474+
`sys_perm_other` varchar(5) DEFAULT NULL,
475+
`server_id` int(11) NOT NULL DEFAULT '0',
476+
`source` varchar(255) DEFAULT NULL,
477+
`access` varchar(255) NOT NULL DEFAULT 'OK',
478+
`active` varchar(255) NOT NULL DEFAULT 'y',
479+
PRIMARY KEY (`relay_recipient_id`)
480+
) ENGINE=MyISAM AUTO_INCREMENT=1 ;
481+
462482

463483
-- --------------------------------------------------------
464484

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
user = {mysql_server_ispconfig_user}
2+
password = {mysql_server_ispconfig_password}
3+
dbname = {mysql_server_database}
4+
table = mail_relay_recipients
5+
select_field = access
6+
where_field = source
7+
additional_conditions = and active = 'y' and server_id = {server_id}
8+
hosts = {mysql_server_ip}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?php
2+
3+
/*
4+
Form Definition
5+
6+
Tabledefinition
7+
8+
Datatypes:
9+
- INTEGER (Forces the input to Int)
10+
- DOUBLE
11+
- CURRENCY (Formats the values to currency notation)
12+
- VARCHAR (no format check, maxlength: 255)
13+
- TEXT (no format check)
14+
- DATE (Dateformat, automatic conversion to timestamps)
15+
16+
Formtype:
17+
- TEXT (Textfield)
18+
- TEXTAREA (Textarea)
19+
- PASSWORD (Password textfield, input is not shown when edited)
20+
- SELECT (Select option field)
21+
- RADIO
22+
- CHECKBOX
23+
- CHECKBOXARRAY
24+
- FILE
25+
26+
VALUE:
27+
- Wert oder Array
28+
29+
Hint:
30+
The ID field of the database table is not part of the datafield definition.
31+
The ID field must be always auto incement (int or bigint).
32+
33+
34+
*/
35+
36+
$form["title"] = "Email relay recipient";
37+
$form["description"] = "";
38+
$form["name"] = "mail_relay_recipient";
39+
$form["action"] = "mail_relay_recipient_edit.php";
40+
$form["db_table"] = "mail_relay_recipient";
41+
$form["db_table_idx"] = "relay_recipient_id";
42+
$form["db_history"] = "yes";
43+
$form["tab_default"] = "relay_recipient";
44+
$form["list_default"] = "mail_relay_recipient_list.php";
45+
$form["auth"] = 'yes'; // yes / no
46+
47+
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
48+
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
49+
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
50+
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
51+
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
52+
53+
$form["tabs"]['relay_recipient'] = array (
54+
'title' => "Relay recipient",
55+
'width' => 100,
56+
'template' => "templates/mail_relay_recipient_edit.htm",
57+
'fields' => array (
58+
##################################
59+
# Begin Datatable fields
60+
##################################
61+
'server_id' => array (
62+
'datatype' => 'INTEGER',
63+
'formtype' => 'SELECT',
64+
'default' => '',
65+
'datasource' => array ( 'type' => 'SQL',
66+
'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
67+
'keyfield'=> 'server_id',
68+
'valuefield'=> 'server_name'
69+
),
70+
'value' => ''
71+
),
72+
'source' => array (
73+
'datatype' => 'VARCHAR',
74+
'formtype' => 'TEXT',
75+
'default' => '',
76+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
77+
'errmsg'=> 'source_error_notempty'),
78+
),
79+
'value' => '',
80+
'width' => '30',
81+
'maxlength' => '255'
82+
),
83+
'access' => array (
84+
'datatype' => 'VARCHAR',
85+
'formtype' => 'TEXT',
86+
'default' => 'OK',
87+
'value' => 'OK',
88+
'width' => '30',
89+
'maxlength' => '255'
90+
),
91+
'active' => array (
92+
'datatype' => 'VARCHAR',
93+
'formtype' => 'CHECKBOX',
94+
'default' => 'y',
95+
'value' => array(0 => 'n',1 => 'y')
96+
),
97+
##################################
98+
# ENDE Datatable fields
99+
##################################
100+
)
101+
);
102+
103+
104+
?>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
$wb["server_id_txt"] = 'Server';
3+
$wb["source_txt"] = 'Relay recipient';
4+
$wb["recipient_txt"] = 'Recipient';
5+
$wb["active_txt"] = 'Active';
6+
$wb["source_error_notempty"] = 'Address is empty.';
7+
$wb["type_txt"] = 'Type';
8+
$wb["limit_mailfilter_txt"] = 'The max. number of email filters for your account is reached.';
9+
?>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
$wb["list_head_txt"] = 'Relay recipients';
3+
$wb["active_txt"] = 'Active';
4+
$wb["server_id_txt"] = 'Server';
5+
$wb["source_txt"] = 'Recipient address';
6+
$wb["recipient_txt"] = 'Recipient';
7+
$wb["add_new_record_txt"] = 'Add new relay recipient';
8+
$wb["access_txt"] = 'access';
9+
?>

interface/web/mail/lib/module.conf.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@
112112
$items[] = array( 'title' => 'Content Filter',
113113
'target' => 'content',
114114
'link' => 'mail/mail_content_filter_list.php');
115+
116+
$items[] = array( 'title' => 'Relay Recipients',
117+
'target' => 'content',
118+
'link' => 'mail/mail_relay_recipient_list.php');
115119

116120
$module['nav'][] = array( 'title' => 'Global Filters',
117121
'open' => 1,
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?php
2+
3+
/*
4+
Datatypes:
5+
- INTEGER
6+
- DOUBLE
7+
- CURRENCY
8+
- VARCHAR
9+
- TEXT
10+
- DATE
11+
*/
12+
13+
14+
15+
// Name of the list
16+
$liste["name"] = "mail_relay_recipient";
17+
18+
// Database table
19+
$liste["table"] = "mail_relay_recipient";
20+
21+
// Index index field of the database table
22+
$liste["table_idx"] = "relay_recipient_id";
23+
24+
// Search Field Prefix
25+
$liste["search_prefix"] = "search_";
26+
27+
// Records per page
28+
$liste["records_per_page"] = 15;
29+
30+
// Script File of the list
31+
$liste["file"] = "mail_relay_recipient_list.php";
32+
33+
// Script file of the edit form
34+
$liste["edit_file"] = "mail_relay_recipient_edit.php";
35+
36+
// Script File of the delete script
37+
$liste["delete_file"] = "mail_relay_recipient_del.php";
38+
39+
// Paging Template
40+
$liste["paging_tpl"] = "templates/paging.tpl.htm";
41+
42+
// Enable auth
43+
$liste["auth"] = "yes";
44+
45+
46+
/*****************************************************
47+
* Suchfelder
48+
*****************************************************/
49+
50+
$liste["item"][] = array( 'field' => "active",
51+
'datatype' => "VARCHAR",
52+
'formtype' => "SELECT",
53+
'op' => "=",
54+
'prefix' => "",
55+
'suffix' => "",
56+
'width' => "",
57+
'value' => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
58+
59+
60+
$liste["item"][] = array( 'field' => "server_id",
61+
'datatype' => "VARCHAR",
62+
'formtype' => "SELECT",
63+
'op' => "like",
64+
'prefix' => "%",
65+
'suffix' => "%",
66+
'datasource' => array ( 'type' => 'SQL',
67+
'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
68+
'keyfield'=> 'server_id',
69+
'valuefield'=> 'server_name'
70+
),
71+
'width' => "",
72+
'value' => "");
73+
74+
75+
$liste["item"][] = array( 'field' => "source",
76+
'datatype' => "VARCHAR",
77+
'formtype' => "TEXT",
78+
'op' => "like",
79+
'prefix' => "%",
80+
'suffix' => "%",
81+
'width' => "",
82+
'value' => "");
83+
84+
85+
?>

0 commit comments

Comments
 (0)