diff --git a/CHANGELOG b/CHANGELOG index 6b5fd6f86..6d9b02b7e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -37,6 +37,7 @@ CHANGELOG Roundcube Webmail - Managesieve: Support filter action with custom IMAP flags (#6011) - Managesieve: Support 'mime' extension tests - RFC5703 (#5832) - Managesieve: Support GSSAPI authentication with krb_authentication plugin (#5779) +- Managesieve: Support enabling the plugin for specified hosts only (#6292) - Password: Support host variables in password_db_dsn option (#5955) - Password: Automatic virtualmin domain setting, removed password_virtualmin_format option (#5759) - Password: Added password_username_format option (#5766) diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog index 6e1f78c63..f109a09ea 100644 --- a/plugins/managesieve/Changelog +++ b/plugins/managesieve/Changelog @@ -1,8 +1,11 @@ +* version 9.1 [2018-05-19] +----------------------------------------------------------- - Added GSSAPI support (#5779) - Added option managesieve_default_headers - Added option managesieve_forward to enable settings dialog for simple forwarding (#6021) - Support filter action with custom IMAP flags (#6011) - Support 'mime' extension tests - RFC5703 (#5832) +- Support enabling the plugin for specified hosts only (#6292) - Support Elastic skin - Fix bug where text: syntax was forced for strings longer than 1024 characters (#6143) - Fix missing Save button in Edit Filter Set page of Classic skin (#6154) diff --git a/plugins/managesieve/config.inc.php.dist b/plugins/managesieve/config.inc.php.dist index 1d016b9e4..2d10ddbf2 100644 --- a/plugins/managesieve/config.inc.php.dist +++ b/plugins/managesieve/config.inc.php.dist @@ -119,12 +119,11 @@ $config['managesieve_raw_editor'] = true; // Disabled actions // Prevent user from performing specific actions: // list_sets, enable_disable_set, delete_set, new_set, download_set, new_rule, delete_rule -// Note: disabling list_sets removes the Filter sets widget from the UI and means the set defined in managesieve_script_name will always be used (and activated) +// Note: disabling list_sets removes the Filter sets widget from the UI and means +// the set defined in managesieve_script_name will always be used (and activated) $config['managesieve_disabled_actions'] = array(); -// Allowed hosts -// Only activate managesieve for selected hosts -// If this is not set, existing behaviour is maintained. -// If set, managesieve will work only for hosts contained in the managesieve_allowed_hosts array -// $config['managesieve_allowed_hosts'] = array('host1.mydomain.com','host2.mydomain.com'); - +// List of hosts that support managesieve. +// Activate managesieve for selected hosts only. If this is not set all hosts are allowed. +// Example: $config['managesieve_allowed_hosts'] = array('host1.mydomain.com','host2.mydomain.com'); +$config['managesieve_allowed_hosts'] = null; diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php index 594c0b119..a1850704b 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php @@ -60,7 +60,7 @@ class rcube_sieve_engine ); private $disabled_actions; - const VERSION = '9.0'; + const VERSION = '9.1'; const PROGNAME = 'Roundcube (Managesieve)'; const PORT = 4190; diff --git a/plugins/managesieve/managesieve.php b/plugins/managesieve/managesieve.php index f42ca2683..bc0483c56 100644 --- a/plugins/managesieve/managesieve.php +++ b/plugins/managesieve/managesieve.php @@ -101,15 +101,14 @@ class managesieve extends rcube_plugin function settings_actions($args) { $this->load_config(); - - if( $this->rc->config->get('managesieve_allowed_hosts') !== null && - ! in_array( $this->rc->user->data['mail_host'], - $this->rc->config->get('managesieve_allowed_hosts') ) ){ - return; - } - + + $allowed_hosts = $this->rc->config->get('managesieve_allowed_hosts'); $vacation_mode = (int) $this->rc->config->get('managesieve_vacation'); - $forward_mode = (int) $this->rc->config->get('managesieve_forward'); + $forward_mode = (int) $this->rc->config->get('managesieve_forward'); + + if (!empty($allowed_hosts) && !in_array($_SESSION['storage_host'], (array) $allowed_hosts)) { + return; + } // register Filters action if ($vacation_mode != 2 && $forward_mode != 2) {