diff --git a/data/Dockerfiles/dovecot/Dockerfile b/data/Dockerfiles/dovecot/Dockerfile index 27413ed0..d7f9cf38 100644 --- a/data/Dockerfiles/dovecot/Dockerfile +++ b/data/Dockerfiles/dovecot/Dockerfile @@ -3,8 +3,8 @@ LABEL maintainer "Andre Peters " ARG DEBIAN_FRONTEND=noninteractive ENV LC_ALL C -ENV DOVECOT_VERSION 2.2.31 -ENV PIGEONHOLE_VERSION 0.4.18 +ENV DOVECOT_VERSION 2.2.32 +ENV PIGEONHOLE_VERSION 0.4.20 RUN apt-get update && apt-get -y install \ automake \ diff --git a/data/Dockerfiles/dovecot/imapsync_cron.pl b/data/Dockerfiles/dovecot/imapsync_cron.pl index 26b5ad67..132e536e 100755 --- a/data/Dockerfiles/dovecot/imapsync_cron.pl +++ b/data/Dockerfiles/dovecot/imapsync_cron.pl @@ -33,7 +33,7 @@ open my $file, '<', "/etc/sogo/sieve.creds"; my $creds = <$file>; close $file; my ($master_user, $master_pass) = split /:/, $creds; -my $sth = $dbh->prepare("SELECT id, user1, user2, host1, authmech1, password1, exclude, port1, enc1, delete2duplicates, maxage, subfolder2, delete1 FROM imapsync WHERE active = 1 AND (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(last_run) > mins_interval * 60 OR last_run IS NULL) ORDER BY last_run"); +my $sth = $dbh->prepare("SELECT id, user1, user2, host1, authmech1, password1, exclude, port1, enc1, delete2duplicates, maxage, subfolder2, delete1, delete2 FROM imapsync WHERE active = 1 AND (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(last_run) > mins_interval * 60 OR last_run IS NULL) ORDER BY last_run"); $sth->execute(); my $row; @@ -52,6 +52,7 @@ while ($row = $sth->fetchrow_arrayref()) { $maxage = @$row[10]; $subfolder2 = @$row[11]; $delete1 = @$row[12]; + $delete2 = @$row[13]; if ($enc1 eq "TLS") { $enc1 = "--tls1"; } elsif ($enc1 eq "SSL") { $enc1 = "--ssl1"; } else { undef $enc1; } @@ -71,6 +72,7 @@ while ($row = $sth->fetchrow_arrayref()) { ($maxage eq "0" ? () : ('--maxage', $maxage)), ($delete2duplicates ne "1" ? () : ('--delete2duplicates')), ($delete1 ne "1" ? () : ('--delete')), + ($delete2 ne "1" ? () : ('--delete2')), (!defined($enc1) ? () : ($enc1)), "--host1", $host1, "--user1", $user1, diff --git a/data/web/edit.php b/data/web/edit.php index 4511ab94..0e7460bc 100644 --- a/data/web/edit.php +++ b/data/web/edit.php @@ -666,6 +666,13 @@ if (isset($_SESSION['mailcow_cc_role'])) { +
+
+
+ +
+
+
diff --git a/data/web/inc/functions.inc.php b/data/web/inc/functions.inc.php index 00fb1b4e..79f3c6dc 100644 --- a/data/web/inc/functions.inc.php +++ b/data/web/inc/functions.inc.php @@ -223,11 +223,20 @@ function set_acl() { if (!isset($_SESSION['mailcow_cc_username'])) { return false; } - $username = strtolower(trim($_SESSION['mailcow_cc_username'])); - $stmt = $pdo->prepare("SELECT * FROM `user_acl` WHERE `username` = :username"); - $stmt->execute(array(':username' => $username)); - $acl['acl'] = $stmt->fetch(PDO::FETCH_ASSOC); - unset($acl['acl']['username']); + if ($_SESSION['mailcow_cc_role'] == 'admin' || $_SESSION['mailcow_cc_role'] == 'domainadmin') { + $stmt = $pdo->query("SHOW COLUMNS FROM `user_acl` WHERE `Field` != 'username';"); + $acl_all = $stmt->fetchAll(PDO::FETCH_ASSOC); + while ($row = array_shift($acl_all)) { + $acl['acl'][$row['Field']] = 1; + } + } + else { + $username = strtolower(trim($_SESSION['mailcow_cc_username'])); + $stmt = $pdo->prepare("SELECT * FROM `user_acl` WHERE `username` = :username"); + $stmt->execute(array(':username' => $username)); + $acl['acl'] = $stmt->fetch(PDO::FETCH_ASSOC); + unset($acl['acl']['username']); + } if (!empty($acl)) { $_SESSION = array_merge($_SESSION, $acl); } diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php index e6261172..4baca2b7 100644 --- a/data/web/inc/functions.mailbox.inc.php +++ b/data/web/inc/functions.mailbox.inc.php @@ -105,6 +105,7 @@ function mailbox($_action, $_type, $_data = null) { $active = intval($_data['active']); $delete2duplicates = intval($_data['delete2duplicates']); $delete1 = intval($_data['delete1']); + $delete2 = intval($_data['delete2']); $port1 = $_data['port1']; $host1 = strtolower($_data['host1']); $password1 = $_data['password1']; @@ -176,13 +177,14 @@ function mailbox($_action, $_type, $_data = null) { return false; } try { - $stmt = $pdo->prepare("INSERT INTO `imapsync` (`user2`, `exclude`, `delete1`, `maxage`, `subfolder2`, `host1`, `authmech1`, `user1`, `password1`, `mins_interval`, `port1`, `enc1`, `delete2duplicates`, `active`) - VALUES (:user2, :exclude, :maxage, :delete1, :subfolder2, :host1, :authmech1, :user1, :password1, :mins_interval, :port1, :enc1, :delete2duplicates, :active)"); + $stmt = $pdo->prepare("INSERT INTO `imapsync` (`user2`, `exclude`, `delete1`, `delete2`, `maxage`, `subfolder2`, `host1`, `authmech1`, `user1`, `password1`, `mins_interval`, `port1`, `enc1`, `delete2duplicates`, `active`) + VALUES (:user2, :exclude, :maxage, :delete1, :delete2, :subfolder2, :host1, :authmech1, :user1, :password1, :mins_interval, :port1, :enc1, :delete2duplicates, :active)"); $stmt->execute(array( ':user2' => $username, ':exclude' => $exclude, ':maxage' => $maxage, ':delete1' => $delete1, + ':delete2' => $delete2, ':subfolder2' => $subfolder2, ':host1' => $host1, ':authmech1' => 'PLAIN', @@ -1265,6 +1267,7 @@ function mailbox($_action, $_type, $_data = null) { $active = (isset($_data['active'])) ? intval($_data['active']) : $is_now['active_int']; $delete2duplicates = (isset($_data['delete2duplicates'])) ? intval($_data['delete2duplicates']) : $is_now['delete2duplicates']; $delete1 = (isset($_data['delete1'])) ? intval($_data['delete1']) : $is_now['delete1']; + $delete2 = (isset($_data['delete2'])) ? intval($_data['delete2']) : $is_now['delete2']; $port1 = (!empty($_data['port1'])) ? $_data['port1'] : $is_now['port1']; $password1 = (!empty($_data['password1'])) ? $_data['password1'] : $is_now['password1']; $host1 = (!empty($_data['host1'])) ? $_data['host1'] : $is_now['host1']; @@ -1323,10 +1326,11 @@ function mailbox($_action, $_type, $_data = null) { return false; } try { - $stmt = $pdo->prepare("UPDATE `imapsync` SET `delete1` = :delete1, `maxage` = :maxage, `subfolder2` = :subfolder2, `exclude` = :exclude, `host1` = :host1, `user1` = :user1, `password1` = :password1, `mins_interval` = :mins_interval, `port1` = :port1, `enc1` = :enc1, `delete2duplicates` = :delete2duplicates, `active` = :active + $stmt = $pdo->prepare("UPDATE `imapsync` SET `delete1` = :delete1, `delete2` = :delete2, `maxage` = :maxage, `subfolder2` = :subfolder2, `exclude` = :exclude, `host1` = :host1, `user1` = :user1, `password1` = :password1, `mins_interval` = :mins_interval, `port1` = :port1, `enc1` = :enc1, `delete2duplicates` = :delete2duplicates, `active` = :active WHERE `id` = :id"); $stmt->execute(array( ':delete1' => $delete1, + ':delete2' => $delete2, ':id' => $id, ':exclude' => $exclude, ':maxage' => $maxage, diff --git a/data/web/inc/init_db.inc.php b/data/web/inc/init_db.inc.php index 6b1aeec1..2589607c 100644 --- a/data/web/inc/init_db.inc.php +++ b/data/web/inc/init_db.inc.php @@ -3,7 +3,7 @@ function init_db_schema() { try { global $pdo; - $db_version = "02082017_0938"; + $db_version = "31082017_0853"; $stmt = $pdo->query("SHOW TABLES LIKE 'versions'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); @@ -274,6 +274,7 @@ function init_db_schema() { "enc1" => "ENUM('TLS','SSL','PLAIN') DEFAULT 'TLS'", "delete2duplicates" => "TINYINT(1) NOT NULL DEFAULT '1'", "delete1" => "TINYINT(1) NOT NULL DEFAULT '0'", + "delete2" => "TINYINT(1) NOT NULL DEFAULT '0'", "returned_text" => "TEXT", "last_run" => "TIMESTAMP NULL DEFAULT NULL", "created" => "DATETIME(0) NOT NULL DEFAULT NOW(0)", diff --git a/data/web/lang/lang.de.php b/data/web/lang/lang.de.php index 63af5175..f857f3e5 100644 --- a/data/web/lang/lang.de.php +++ b/data/web/lang/lang.de.php @@ -344,8 +344,10 @@ $lang['add']['mins_interval'] = 'Abrufintervall (Minuten)'; $lang['add']['exclude'] = 'Elemente ausschließen (Regex)'; $lang['add']['delete2duplicates'] = 'Lösche Duplikate im Ziel'; $lang['add']['delete1'] = 'Lösche Nachricht nach Übertragung vom Quell-Server'; +$lang['add']['delete2'] = 'Lösche Nachrichten von Ziel-Server, die nicht auf Quell-Server vorhanden sind'; $lang['edit']['delete2duplicates'] = 'Lösche Duplikate im Ziel'; $lang['edit']['delete1'] = 'Lösche Nachricht nach Übertragung vom Quell-Server'; +$lang['edit']['delete2'] = 'Lösche Nachrichten von Ziel-Server, die nicht auf Quell-Server vorhanden sind'; $lang['add']['title'] = 'Objekt anlegen'; $lang['add']['domain'] = 'Domain'; diff --git a/data/web/lang/lang.en.php b/data/web/lang/lang.en.php index 11c1c045..4487e48a 100644 --- a/data/web/lang/lang.en.php +++ b/data/web/lang/lang.en.php @@ -349,8 +349,10 @@ $lang['add']['subfolder2'] = 'Sync into subfolder on destination'; $lang['add']['exclude'] = 'Exclude objects (regex)'; $lang['add']['delete2duplicates'] = 'Delete duplicates on destination'; $lang['add']['delete1'] = 'Delete from source when completed'; +$lang['add']['delete2'] = 'Delete messages on destination that are not on source'; $lang['edit']['delete2duplicates'] = 'Delete duplicates on destination'; $lang['edit']['delete1'] = 'Delete from source when completed'; +$lang['edit']['delete2'] = 'Delete messages on destination that are not on source'; $lang['add']['title'] = 'Add object'; $lang['add']['domain'] = 'Domain'; diff --git a/data/web/modals/user.php b/data/web/modals/user.php index 3e2a8d12..e237a74b 100644 --- a/data/web/modals/user.php +++ b/data/web/modals/user.php @@ -87,6 +87,13 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
+
+
+
+ +
+
+
diff --git a/docker-compose.yml b/docker-compose.yml index 0d865ee1..f4ce41d6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -164,7 +164,7 @@ services: - sogo dovecot-mailcow: - image: mailcow/dovecot:1.6 + image: mailcow/dovecot:1.7 build: ./data/Dockerfiles/dovecot depends_on: unbound-mailcow: