From cf1e633b1a2c4282b5b35274b085d7e6cc47bac1 Mon Sep 17 00:00:00 2001 From: Gamal Abdul Nasser Date: Thu, 7 Nov 2019 10:37:09 +0700 Subject: [PATCH 1/2] list mailbox, alias/forwarder by domain using extra parameter --- data/web/json_api.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/data/web/json_api.php b/data/web/json_api.php index 66e9f22e..161a1b0c 100644 --- a/data/web/json_api.php +++ b/data/web/json_api.php @@ -601,7 +601,12 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u case "mailbox": switch ($object) { case "all": - $domains = mailbox('get', 'domains'); + if(empty($extra)) { + $domains = mailbox('get', 'domains'); + } + else { + $domains = [ $extra ]; + } if (!empty($domains)) { foreach ($domains as $domain) { $mailboxes = mailbox('get', 'mailboxes', $domain); @@ -940,7 +945,12 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u case "alias": switch ($object) { case "all": - $domains = array_merge(mailbox('get', 'domains'), mailbox('get', 'alias_domains')); + if(empty($extra)) { + $domains = array_merge(mailbox('get', 'domains'), mailbox('get', 'alias_domains')); + } + else { + $domains = [ $extra ]; + } if (!empty($domains)) { foreach ($domains as $domain) { $aliases = mailbox('get', 'aliases', $domain); From d28e0f2be072f5031050d0ec4a94e963a12ff05c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Peters?= Date: Sat, 9 Nov 2019 09:59:07 +0100 Subject: [PATCH 2/2] Update json_api.php --- data/web/json_api.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data/web/json_api.php b/data/web/json_api.php index 161a1b0c..e2a7ef62 100644 --- a/data/web/json_api.php +++ b/data/web/json_api.php @@ -601,11 +601,11 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u case "mailbox": switch ($object) { case "all": - if(empty($extra)) { + if (empty($extra)) { $domains = mailbox('get', 'domains'); } else { - $domains = [ $extra ]; + $domains = array($extra); } if (!empty($domains)) { foreach ($domains as $domain) { @@ -945,11 +945,11 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u case "alias": switch ($object) { case "all": - if(empty($extra)) { + if (empty($extra)) { $domains = array_merge(mailbox('get', 'domains'), mailbox('get', 'alias_domains')); } else { - $domains = [ $extra ]; + $domains = array($extra); } if (!empty($domains)) { foreach ($domains as $domain) {