From 540d35870e3a0ee8dc8e054b583e1cc414290600 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Fri, 3 Feb 2023 17:26:39 +0530 Subject: [PATCH 01/17] patch added for get by email --- Dockerfile | 1 + patches/023-patch_getbyemail.patch | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 patches/023-patch_getbyemail.patch diff --git a/Dockerfile b/Dockerfile index 64a024e4..2ca91fbe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -168,6 +168,7 @@ RUN cd ${BASE_DIR}/custom_apps && patch -p0 < ${TMP_PATCH_DIR}/005-autocomplete- RUN cd ${BASE_DIR} && patch -u ${BASE_DIR}/apps/dashboard/lib/Controller/DashboardController.php -i ${TMP_PATCH_DIR}/012-remove-user-status-widget.patch RUN patch -u ${BASE_DIR}/core/templates/layout.guest.php -i ${TMP_PATCH_DIR}/016-login-screen.patch RUN patch -u ${BASE_DIR}/lib/private/Notification/Manager.php -i ${TMP_PATCH_DIR}/020-fairuse-notification-fix.patch +RUN patch -u ${BASE_DIR}/lib/private/User/Manager.php -i ${TMP_PATCH_DIR}/023-patch_getbyemail.patch RUN rm -rf ${TMP_PATCH_DIR} RUN curl -fsSL -o ldap_write_support.tar.gz \ diff --git a/patches/023-patch_getbyemail.patch b/patches/023-patch_getbyemail.patch new file mode 100644 index 00000000..96fa4d4d --- /dev/null +++ b/patches/023-patch_getbyemail.patch @@ -0,0 +1,29 @@ +--- lib/private/User/Manager.php 2023-02-03 17:18:44.729561986 +0530 ++++ lib/private/User/Manager-new.php 2023-02-03 17:20:18.929562546 +0530 +@@ -705,16 +705,18 @@ + * @since 9.1.0 + */ + public function getByEmail($email) { +- // looking for 'email' only (and not primary_mail) is intentional +- $userIds = $this->config->getUsersForUserValueCaseInsensitive('settings', 'email', $email); ++ $uid=$email; // get first part of email if it contains alt domain, otherwise it is just $email ++ $alt_domain = $this->config->getSystemValue('alt_mail_domain', ''); ++ $alt_domain_suffix = !empty($alt_domain) ? '@' . $alt_domain : ''; + +- $users = array_map(function ($uid) { +- return $this->get($uid); +- }, $userIds); ++ if (stristr($email, $alt_domain_suffix) !== FALSE) { ++ $uid = str_replace($alt_domain_suffix, '', $email); ++ } + +- return array_values(array_filter($users, function ($u) { +- return ($u instanceof IUser); +- })); ++ if($this->get($uid)) { ++ return([$this->get($uid)]); ++ } ++ return []; + } + + private function verifyUid(string $uid): bool { -- GitLab From dcd950b81dcf4f8bed58b3339a584821732369e3 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Fri, 3 Feb 2023 17:40:57 +0530 Subject: [PATCH 02/17] version bump --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2ca91fbe..dd205c00 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ ARG ECLOUD_LAUNCHER_JOB_ID="458901" ARG GOOGLE_INTEGRATION_VERSION="1.0.8" ARG ECLOUD_DASHBOARD_JOB_ID="485170" -RUN sed -i 's/24,0,8,2/24,0,8,7/' ${BASE_DIR}/version.php +RUN sed -i 's/24,0,8,2/24,0,8,8/' ${BASE_DIR}/version.php COPY custom_entrypoint.sh / RUN chmod +x /custom_entrypoint.sh RUN mkdir -p /var/www/skeleton/Documents && mkdir -p /var/www/skeleton/Images -- GitLab From 5838c888635e5238d3eaa5f885f122845ebdf318 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Fri, 3 Feb 2023 18:02:14 +0530 Subject: [PATCH 03/17] old code added back --- patches/023-patch_getbyemail.patch | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/patches/023-patch_getbyemail.patch b/patches/023-patch_getbyemail.patch index 96fa4d4d..5a90b73c 100644 --- a/patches/023-patch_getbyemail.patch +++ b/patches/023-patch_getbyemail.patch @@ -1,29 +1,21 @@ --- lib/private/User/Manager.php 2023-02-03 17:18:44.729561986 +0530 -+++ lib/private/User/Manager-new.php 2023-02-03 17:20:18.929562546 +0530 -@@ -705,16 +705,18 @@ ++++ lib/private/User/Manager-new.php 2023-02-03 18:00:50.509563655 +0530 +@@ -705,6 +705,18 @@ * @since 9.1.0 */ public function getByEmail($email) { -- // looking for 'email' only (and not primary_mail) is intentional -- $userIds = $this->config->getUsersForUserValueCaseInsensitive('settings', 'email', $email); + $uid=$email; // get first part of email if it contains alt domain, otherwise it is just $email + $alt_domain = $this->config->getSystemValue('alt_mail_domain', ''); + $alt_domain_suffix = !empty($alt_domain) ? '@' . $alt_domain : ''; - -- $users = array_map(function ($uid) { -- return $this->get($uid); -- }, $userIds); ++ + if (stristr($email, $alt_domain_suffix) !== FALSE) { + $uid = str_replace($alt_domain_suffix, '', $email); + } - -- return array_values(array_filter($users, function ($u) { -- return ($u instanceof IUser); -- })); -+ if($this->get($uid)) { ++ ++ if ($this->get($uid)) { + return([$this->get($uid)]); -+ } -+ return []; - } - - private function verifyUid(string $uid): bool { ++ } ++ + // looking for 'email' only (and not primary_mail) is intentional + $userIds = $this->config->getUsersForUserValueCaseInsensitive('settings', 'email', $email); + -- GitLab From f44a717a39b83c411e3800880376e2e325b62230 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Thu, 9 Feb 2023 17:46:33 +0530 Subject: [PATCH 04/17] patch fix for empty alt domain --- patches/023-patch_getbyemail.patch | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/patches/023-patch_getbyemail.patch b/patches/023-patch_getbyemail.patch index 5a90b73c..63b35792 100644 --- a/patches/023-patch_getbyemail.patch +++ b/patches/023-patch_getbyemail.patch @@ -1,19 +1,21 @@ ---- lib/private/User/Manager.php 2023-02-03 17:18:44.729561986 +0530 -+++ lib/private/User/Manager-new.php 2023-02-03 18:00:50.509563655 +0530 -@@ -705,6 +705,18 @@ +--- ./lib/private/User/Manager.php 2023-02-03 17:18:44.729561986 +0530 ++++ ./lib/private/User/Manager-new.php 2023-02-09 17:37:59.809738289 +0530 +@@ -705,6 +705,20 @@ * @since 9.1.0 */ public function getByEmail($email) { + $uid=$email; // get first part of email if it contains alt domain, otherwise it is just $email + $alt_domain = $this->config->getSystemValue('alt_mail_domain', ''); -+ $alt_domain_suffix = !empty($alt_domain) ? '@' . $alt_domain : ''; ++ if (isset($alt_domain)) { ++ $alt_domain_suffix = !empty($alt_domain) ? '@' . $alt_domain : ''; + -+ if (stristr($email, $alt_domain_suffix) !== FALSE) { -+ $uid = str_replace($alt_domain_suffix, '', $email); -+ } ++ if (stristr($email, $alt_domain_suffix) !== FALSE) { ++ $uid = str_replace($alt_domain_suffix, '', $email); ++ } + -+ if ($this->get($uid)) { -+ return([$this->get($uid)]); ++ if ($this->get($uid)) { ++ return([$this->get($uid)]); ++ } + } + // looking for 'email' only (and not primary_mail) is intentional -- GitLab From ea45c82b4e85acf9d265ea82a07ec0f79dd4466d Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Thu, 9 Feb 2023 17:50:32 +0530 Subject: [PATCH 05/17] version bump --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index dd205c00..ae286837 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ ARG ECLOUD_LAUNCHER_JOB_ID="458901" ARG GOOGLE_INTEGRATION_VERSION="1.0.8" ARG ECLOUD_DASHBOARD_JOB_ID="485170" -RUN sed -i 's/24,0,8,2/24,0,8,8/' ${BASE_DIR}/version.php +RUN sed -i 's/24,0,8,2/24,0,8,9/' ${BASE_DIR}/version.php COPY custom_entrypoint.sh / RUN chmod +x /custom_entrypoint.sh RUN mkdir -p /var/www/skeleton/Documents && mkdir -p /var/www/skeleton/Images -- GitLab From 3b7d8d6b31bd0a67e810bf0f1494bd93c2b87d3a Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Thu, 9 Feb 2023 19:37:26 +0530 Subject: [PATCH 06/17] if moved --- patches/023-patch_getbyemail.patch | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/patches/023-patch_getbyemail.patch b/patches/023-patch_getbyemail.patch index 63b35792..30d93e5c 100644 --- a/patches/023-patch_getbyemail.patch +++ b/patches/023-patch_getbyemail.patch @@ -1,6 +1,6 @@ --- ./lib/private/User/Manager.php 2023-02-03 17:18:44.729561986 +0530 -+++ ./lib/private/User/Manager-new.php 2023-02-09 17:37:59.809738289 +0530 -@@ -705,6 +705,20 @@ ++++ ./lib/private/User/Manager-new.php 2023-02-09 19:35:34.309722378 +0530 +@@ -705,6 +705,19 @@ * @since 9.1.0 */ public function getByEmail($email) { @@ -13,11 +13,10 @@ + $uid = str_replace($alt_domain_suffix, '', $email); + } + -+ if ($this->get($uid)) { -+ return([$this->get($uid)]); -+ } + } -+ ++ if ($this->get($uid)) { ++ return([$this->get($uid)]); ++ } // looking for 'email' only (and not primary_mail) is intentional $userIds = $this->config->getUsersForUserValueCaseInsensitive('settings', 'email', $email); -- GitLab From cfb546fad146f1ebbdc2121d7f1363f33727d8e0 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Thu, 9 Feb 2023 19:55:41 +0530 Subject: [PATCH 07/17] code refactoring --- patches/023-patch_getbyemail.patch | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/patches/023-patch_getbyemail.patch b/patches/023-patch_getbyemail.patch index 30d93e5c..cbbe67e2 100644 --- a/patches/023-patch_getbyemail.patch +++ b/patches/023-patch_getbyemail.patch @@ -1,19 +1,20 @@ --- ./lib/private/User/Manager.php 2023-02-03 17:18:44.729561986 +0530 -+++ ./lib/private/User/Manager-new.php 2023-02-09 19:35:34.309722378 +0530 -@@ -705,6 +705,19 @@ ++++ ./lib/private/User/Manager-new.php 2023-02-09 19:53:49.539733394 +0530 +@@ -705,6 +705,20 @@ * @since 9.1.0 */ public function getByEmail($email) { + $uid=$email; // get first part of email if it contains alt domain, otherwise it is just $email + $alt_domain = $this->config->getSystemValue('alt_mail_domain', ''); -+ if (isset($alt_domain)) { -+ $alt_domain_suffix = !empty($alt_domain) ? '@' . $alt_domain : ''; -+ -+ if (stristr($email, $alt_domain_suffix) !== FALSE) { -+ $uid = str_replace($alt_domain_suffix, '', $email); -+ } ++ $alt_domain_suffix =''; ++ if (isset($alt_domain) && !empty($alt_domain)) { ++ $alt_domain_suffix ='@' . $alt_domain; ++ } + ++ if (stristr($email, $alt_domain_suffix) !== FALSE) { ++ $uid = str_replace($alt_domain_suffix, '', $email); + } ++ + if ($this->get($uid)) { + return([$this->get($uid)]); + } -- GitLab From dc26ea8ba3cb41e39debc40ad1a9825c8e969806 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Thu, 9 Feb 2023 21:44:31 +0530 Subject: [PATCH 08/17] suggestion implemented --- patches/023-patch_getbyemail.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/patches/023-patch_getbyemail.patch b/patches/023-patch_getbyemail.patch index cbbe67e2..b179ba61 100644 --- a/patches/023-patch_getbyemail.patch +++ b/patches/023-patch_getbyemail.patch @@ -1,5 +1,5 @@ --- ./lib/private/User/Manager.php 2023-02-03 17:18:44.729561986 +0530 -+++ ./lib/private/User/Manager-new.php 2023-02-09 19:53:49.539733394 +0530 ++++ ./lib/private/User/Manager-new.php 2023-02-09 21:41:35.339729765 +0530 @@ -705,6 +705,20 @@ * @since 9.1.0 */ @@ -11,12 +11,12 @@ + $alt_domain_suffix ='@' . $alt_domain; + } + -+ if (stristr($email, $alt_domain_suffix) !== FALSE) { ++ if (!empty($alt_domain_suffix) && stristr($email, $alt_domain_suffix) !== FALSE) { + $uid = str_replace($alt_domain_suffix, '', $email); + } + -+ if ($this->get($uid)) { -+ return([$this->get($uid)]); ++ if ($user = $this->get($uid)) { ++ return([$user]); + } // looking for 'email' only (and not primary_mail) is intentional $userIds = $this->config->getUsersForUserValueCaseInsensitive('settings', 'email', $email); -- GitLab From a61eb7efca55abf7a81edd52e52de0793de77698 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Fri, 10 Feb 2023 17:07:57 +0530 Subject: [PATCH 09/17] suggestion implemented return blank array --- patches/023-patch_getbyemail.patch | 32 ++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/patches/023-patch_getbyemail.patch b/patches/023-patch_getbyemail.patch index b179ba61..05136128 100644 --- a/patches/023-patch_getbyemail.patch +++ b/patches/023-patch_getbyemail.patch @@ -1,16 +1,44 @@ --- ./lib/private/User/Manager.php 2023-02-03 17:18:44.729561986 +0530 -+++ ./lib/private/User/Manager-new.php 2023-02-09 21:41:35.339729765 +0530 -@@ -705,6 +705,20 @@ ++++ ./lib/private/User/Manager-new.php 2023-02-10 16:40:27.367230901 +0530 +@@ -705,6 +705,48 @@ * @since 9.1.0 */ public function getByEmail($email) { + $uid=$email; // get first part of email if it contains alt domain, otherwise it is just $email ++ $mail_domain = $this->config->getSystemValue('mail_domain', ''); + $alt_domain = $this->config->getSystemValue('alt_mail_domain', ''); ++ + $alt_domain_suffix =''; ++ $domain_found=1; ++ ++ if (isset($mail_domain) && !empty($mail_domain)) { ++ $mail_domain_suffix ='@' . $mail_domain; ++ } ++ + if (isset($alt_domain) && !empty($alt_domain)) { + $alt_domain_suffix ='@' . $alt_domain; + } + ++ if (!empty($mail_domain_suffix) && stristr($email, $mail_domain_suffix) == FALSE) { ++ $domain_found=0; ++ } ++ ++ if (!empty($alt_domain_suffix) && stristr($email, $alt_domain_suffix) == FALSE) { ++ $domain_found=0; ++ } ++ ++ if($domain_found == 0){ ++ return []; ++ } ++ ++ if (!empty($alt_domain_suffix) && stristr($email, $alt_domain_suffix) !== FALSE) { ++ $uid = str_replace($alt_domain_suffix, '', $email); ++ } ++ ++ if (!empty($alt_domain_suffix) && stristr($email, $alt_domain_suffix) !== FALSE) { ++ $uid = str_replace($alt_domain_suffix, '', $email); ++ } ++ + if (!empty($alt_domain_suffix) && stristr($email, $alt_domain_suffix) !== FALSE) { + $uid = str_replace($alt_domain_suffix, '', $email); + } -- GitLab From 27a55c99d5c9278aad1c18daca00c730972f7c7c Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Fri, 10 Feb 2023 17:11:23 +0530 Subject: [PATCH 10/17] suggestion implemented return blank array --- patches/023-patch_getbyemail.patch | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/patches/023-patch_getbyemail.patch b/patches/023-patch_getbyemail.patch index 05136128..d77bbf72 100644 --- a/patches/023-patch_getbyemail.patch +++ b/patches/023-patch_getbyemail.patch @@ -1,6 +1,6 @@ --- ./lib/private/User/Manager.php 2023-02-03 17:18:44.729561986 +0530 -+++ ./lib/private/User/Manager-new.php 2023-02-10 16:40:27.367230901 +0530 -@@ -705,6 +705,48 @@ ++++ ./lib/private/User/Manager-new.php 2023-02-10 17:10:18.767230727 +0530 +@@ -705,6 +705,49 @@ * @since 9.1.0 */ public function getByEmail($email) { @@ -8,6 +8,7 @@ + $mail_domain = $this->config->getSystemValue('mail_domain', ''); + $alt_domain = $this->config->getSystemValue('alt_mail_domain', ''); + ++ $mail_domain_suffix =''; + $alt_domain_suffix =''; + $domain_found=1; + -- GitLab From 9ae49d92b832185d5b6178d58533e9e84dd7742f Mon Sep 17 00:00:00 2001 From: Akhil Date: Fri, 10 Mar 2023 09:56:53 +0530 Subject: [PATCH 11/17] Fix get by email patch --- Dockerfile | 2 +- patches/023-optimize-get-by-email.patch | 44 +++++++++++++++++++++ patches/023-patch_getbyemail.patch | 52 ------------------------- 3 files changed, 45 insertions(+), 53 deletions(-) create mode 100644 patches/023-optimize-get-by-email.patch delete mode 100644 patches/023-patch_getbyemail.patch diff --git a/Dockerfile b/Dockerfile index ae286837..93c8dace 100644 --- a/Dockerfile +++ b/Dockerfile @@ -168,7 +168,7 @@ RUN cd ${BASE_DIR}/custom_apps && patch -p0 < ${TMP_PATCH_DIR}/005-autocomplete- RUN cd ${BASE_DIR} && patch -u ${BASE_DIR}/apps/dashboard/lib/Controller/DashboardController.php -i ${TMP_PATCH_DIR}/012-remove-user-status-widget.patch RUN patch -u ${BASE_DIR}/core/templates/layout.guest.php -i ${TMP_PATCH_DIR}/016-login-screen.patch RUN patch -u ${BASE_DIR}/lib/private/Notification/Manager.php -i ${TMP_PATCH_DIR}/020-fairuse-notification-fix.patch -RUN patch -u ${BASE_DIR}/lib/private/User/Manager.php -i ${TMP_PATCH_DIR}/023-patch_getbyemail.patch +RUN patch -u ${BASE_DIR}/lib/private/User/Manager.php -i ${TMP_PATCH_DIR}/023-optimize-get-by-email.patch RUN rm -rf ${TMP_PATCH_DIR} RUN curl -fsSL -o ldap_write_support.tar.gz \ diff --git a/patches/023-optimize-get-by-email.patch b/patches/023-optimize-get-by-email.patch new file mode 100644 index 00000000..7673feb2 --- /dev/null +++ b/patches/023-optimize-get-by-email.patch @@ -0,0 +1,44 @@ +From: Akhil +Date: Tue, 10 Mar 2023 10:00 +0530 +Subject: [PATCH] To optimize getByEmail as we have boundary conditions that email is unique per-user and can only match one of the two domains + +--- ./lib/private/User/Manager.php 2023-03-10 10:01:44.729561986 +0530 ++++ ./lib/private/User/Manager-new.php 2023-03-10 10:05:18.767230727 +0530 +@@ -706,11 +706,33 @@ + */ + public function getByEmail($email) { + // looking for 'email' only (and not primary_mail) is intentional +- $userIds = $this->config->getUsersForUserValueCaseInsensitive('settings', 'email', $email); ++ $mailDomain = $this->config->getSystemValue('mail_domain', ''); ++ $altMailDomain = $this->config->getSystemValue('alt_mail_domain', ''); ++ $users = []; ++ ++ if(empty($mailDomain) && empty($altMailDomain)) { ++ $userIds = $this->config->getUsersForUserValueCaseInsensitive('settings', 'email', $email); + +- $users = array_map(function ($uid) { +- return $this->get($uid); +- }, $userIds); ++ $users = array_map(function ($uid) { ++ return $this->get($uid); ++ }, $userIds); ++ } else { ++ $uid = ''; ++ $mailDomainSuffix = empty($mailDomain) ? '' : '@' . $mailDomain; ++ $altMailDomainSuffix = empty($altMailDomain) ? '' : '@' . $altMailDomain; ++ ++ if (!empty($mailDomainSuffix) && stristr($email, $mailDomainSuffix) !== FALSE) { ++ // In case of mail_domain, username is email ++ $uid = $email; ++ } else if (!empty($altMailDomainSuffix) && stristr($email, $altMailDomainSuffix) !== FALSE) { ++ // In case of alt_mail_domain, username is email without domain suffix ++ $uid = str_replace($altMailDomainSuffix, '', $email); ++ } ++ // If no match of domain, no user ++ if(!empty($uid)) { ++ $users = [$this->get($uid)]; ++ } ++ } + + return array_values(array_filter($users, function ($u) { + return ($u instanceof IUser); diff --git a/patches/023-patch_getbyemail.patch b/patches/023-patch_getbyemail.patch deleted file mode 100644 index d77bbf72..00000000 --- a/patches/023-patch_getbyemail.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- ./lib/private/User/Manager.php 2023-02-03 17:18:44.729561986 +0530 -+++ ./lib/private/User/Manager-new.php 2023-02-10 17:10:18.767230727 +0530 -@@ -705,6 +705,49 @@ - * @since 9.1.0 - */ - public function getByEmail($email) { -+ $uid=$email; // get first part of email if it contains alt domain, otherwise it is just $email -+ $mail_domain = $this->config->getSystemValue('mail_domain', ''); -+ $alt_domain = $this->config->getSystemValue('alt_mail_domain', ''); -+ -+ $mail_domain_suffix =''; -+ $alt_domain_suffix =''; -+ $domain_found=1; -+ -+ if (isset($mail_domain) && !empty($mail_domain)) { -+ $mail_domain_suffix ='@' . $mail_domain; -+ } -+ -+ if (isset($alt_domain) && !empty($alt_domain)) { -+ $alt_domain_suffix ='@' . $alt_domain; -+ } -+ -+ if (!empty($mail_domain_suffix) && stristr($email, $mail_domain_suffix) == FALSE) { -+ $domain_found=0; -+ } -+ -+ if (!empty($alt_domain_suffix) && stristr($email, $alt_domain_suffix) == FALSE) { -+ $domain_found=0; -+ } -+ -+ if($domain_found == 0){ -+ return []; -+ } -+ -+ if (!empty($alt_domain_suffix) && stristr($email, $alt_domain_suffix) !== FALSE) { -+ $uid = str_replace($alt_domain_suffix, '', $email); -+ } -+ -+ if (!empty($alt_domain_suffix) && stristr($email, $alt_domain_suffix) !== FALSE) { -+ $uid = str_replace($alt_domain_suffix, '', $email); -+ } -+ -+ if (!empty($alt_domain_suffix) && stristr($email, $alt_domain_suffix) !== FALSE) { -+ $uid = str_replace($alt_domain_suffix, '', $email); -+ } -+ -+ if ($user = $this->get($uid)) { -+ return([$user]); -+ } - // looking for 'email' only (and not primary_mail) is intentional - $userIds = $this->config->getUsersForUserValueCaseInsensitive('settings', 'email', $email); - -- GitLab From 7b20a226ac4d4d97a5c395cb41e8db7d177fa6fe Mon Sep 17 00:00:00 2001 From: Akhil Date: Wed, 1 Mar 2023 19:07:15 +0000 Subject: [PATCH 12/17] Ldap check pwd patch --- Dockerfile | 39 ++++-------- custom_entrypoint.sh | 2 - patches/012-remove-user-status-widget.patch | 18 ------ patches/023-ldap-check-pwd-optimization.patch | 59 +++++++++++++++++++ 4 files changed, 70 insertions(+), 48 deletions(-) delete mode 100644 patches/012-remove-user-status-widget.patch create mode 100644 patches/023-ldap-check-pwd-optimization.patch diff --git a/Dockerfile b/Dockerfile index 93c8dace..ea1fc7e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,14 @@ FROM nextcloud:24.0.8-fpm AS nextcloud ARG BASE_DIR="/usr/src/nextcloud" ARG TMP_PATCH_DIR="/tmp/build_patches" -ARG THEME_HELPER_JOB_ID="446245" -ARG NEWS_VERSION="20.0.0" -ARG QUOTA_WARN_VERSION="1.15.0" +ARG THEME_HELPER_JOB_ID="471836" ARG NOTES_VERSION="4.5.1" ARG CONTACTS_JOB_ID="471108" ARG CALENDAR_JOB_ID="471116" -ARG USER_BACKEND_RAW_SQL_VERSION="1.3.0" ARG EMAIL_RECOVERY_JOB_ID="445958" ARG RAINLOOP_VERSION="7.2.5" -ARG RAINLOOP_COMMIT_SHA="523518ba" -ARG EA_JOB_ID="445966" +ARG RAINLOOP_COMMIT_SHA="28a5d603" +ARG EA_JOB_ID="471828" ARG ECLOUD_LAUNCHER_JOB_ID="458901" ARG GOOGLE_INTEGRATION_VERSION="1.0.8" ARG ECLOUD_DASHBOARD_JOB_ID="485170" @@ -23,17 +20,6 @@ RUN mkdir -p /var/www/skeleton/Documents && mkdir -p /var/www/skeleton/Images # Install unzip for unzipping artifacts RUN apt-get update && apt-get install unzip -# Custom apps -RUN curl -fsSL -o news.tar.gz \ - "https://github.com/nextcloud/news/releases/download/${NEWS_VERSION}/news.tar.gz" && \ - tar -xf news.tar.gz -C ${BASE_DIR}/custom_apps/ && \ - rm news.tar.gz; - -RUN curl -fsSL -o quota_warning.tar.gz \ - "https://github.com/nextcloud-releases/quota_warning/releases/download/v${QUOTA_WARN_VERSION}/quota_warning-v${QUOTA_WARN_VERSION}.tar.gz" && \ - tar -xf quota_warning.tar.gz -C ${BASE_DIR}/custom_apps/ && \ - rm quota_warning.tar.gz; - RUN curl -fsSL -o notes.tar.gz \ "https://github.com/nextcloud/notes/releases/download/v${NOTES_VERSION}/notes.tar.gz" && \ tar -xf notes.tar.gz -C ${BASE_DIR}/custom_apps/ && \ @@ -46,18 +32,12 @@ RUN curl -fsSL -o contacts.zip \ mv dist/contacts ${BASE_DIR}/custom_apps/ && \ rm contacts.zip; -# custom Calendar 3.2.4 RUN curl -fsSL -o calendar.zip \ "https://gitlab.e.foundation/e/infra/ecloud/nextcloud-apps/calendar/-/jobs/${CALENDAR_JOB_ID}/artifacts/download" && \ unzip calendar.zip && \ mv dist/calendar ${BASE_DIR}/custom_apps/ && \ rm calendar.zip; -RUN curl -fsSL -o user_backend_sql_raw.tar.gz \ - "https://github.com/PanCakeConnaisseur/user_backend_sql_raw/releases/download/v${USER_BACKEND_RAW_SQL_VERSION}/user_backend_sql_raw.tar.gz" && \ - tar -xf user_backend_sql_raw.tar.gz -C ${BASE_DIR}/custom_apps/ && \ - rm user_backend_sql_raw.tar.gz; - RUN curl -fsSL -o email-recovery.zip \ "https://gitlab.e.foundation/e/infra/ecloud/nextcloud-apps/email-recovery/-/jobs/${EMAIL_RECOVERY_JOB_ID}/artifacts/download" && \ unzip email-recovery.zip && \ @@ -113,6 +93,7 @@ From nextcloud as selfhost ARG BASE_DIR="/usr/src/nextcloud" ARG TMP_PATCH_DIR="/tmp/build_patches" ARG THEME_VERSION="selfhost-22.0.0" +ARG USER_BACKEND_RAW_SQL_VERSION="1.3.0" # Patches COPY patches/ ${TMP_PATCH_DIR}/ @@ -141,6 +122,12 @@ RUN curl -fsSL -o eCloud-theme.tar.gz \ chown -R www-data:www-data ${BASE_DIR}/themes/eCloud/ && \ rm -rf eCloud-theme.tar.gz ${BASE_DIR}/themes/example/ +# User Backend +RUN curl -fsSL -o user_backend_sql_raw.tar.gz \ + "https://github.com/PanCakeConnaisseur/user_backend_sql_raw/releases/download/v${USER_BACKEND_RAW_SQL_VERSION}/user_backend_sql_raw.tar.gz" && \ + tar -xf user_backend_sql_raw.tar.gz -C ${BASE_DIR}/custom_apps/ && \ + rm user_backend_sql_raw.tar.gz; + # Set default class of hidden to settings-hint RUN sed -i 's/settings-hint/settings-hint hidden/' ${BASE_DIR}/apps/settings/templates/settings/personal/security/twofactor.php # change notifications icon src @@ -165,10 +152,9 @@ RUN patch -u ${BASE_DIR}/core/templates/layout.user.php -i ${TMP_PATCH_DIR}/003- RUN patch -u ${BASE_DIR}/core/Controller/ContactsMenuController.php -i ${TMP_PATCH_DIR}/004-contact-search-controller-removal.patch RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/005-autocomplete-user-leak-core.patch RUN cd ${BASE_DIR}/custom_apps && patch -p0 < ${TMP_PATCH_DIR}/005-autocomplete-user-leak-custom-app.patch -RUN cd ${BASE_DIR} && patch -u ${BASE_DIR}/apps/dashboard/lib/Controller/DashboardController.php -i ${TMP_PATCH_DIR}/012-remove-user-status-widget.patch RUN patch -u ${BASE_DIR}/core/templates/layout.guest.php -i ${TMP_PATCH_DIR}/016-login-screen.patch RUN patch -u ${BASE_DIR}/lib/private/Notification/Manager.php -i ${TMP_PATCH_DIR}/020-fairuse-notification-fix.patch -RUN patch -u ${BASE_DIR}/lib/private/User/Manager.php -i ${TMP_PATCH_DIR}/023-optimize-get-by-email.patch +RUN cd ${BASE_DIR} && patch -u ${BASE_DIR}/apps/user_ldap/lib/User_LDAP.php -i ${TMP_PATCH_DIR}/023-ldap-check-pwd-optimization.patch RUN rm -rf ${TMP_PATCH_DIR} RUN curl -fsSL -o ldap_write_support.tar.gz \ @@ -199,9 +185,6 @@ RUN cd ${BASE_DIR}/custom_apps/contacts && sed -i 's/"GROUP","INDIVIDUAL"/"INDIV RUN cd ${BASE_DIR}/custom_apps/calendar && sed -i 's/"GROUP","INDIVIDUAL"/"INDIVIDUAL"/g' js/calendar-main.js RUN cd ${BASE_DIR}/custom_apps/calendar && sed -i 's/{name:\[o,"displayname"\]},//' js/calendar-main.js -# Set default widgets to calendar, tasks and notes -RUN sed -i 's/recommendations,spreed,mail,calendar/calendar,tasks,notes/' ${BASE_DIR}/apps/dashboard/lib/Controller/DashboardController.php - # Remove colored background from email template logo RUN sed -i 's/$this->header, \[$this->themingDefaults->getColorPrimary()/$this->header, \["none"/' ${BASE_DIR}/lib/private/Mail/EMailTemplate.php diff --git a/custom_entrypoint.sh b/custom_entrypoint.sh index ad2911c5..f7fe2658 100644 --- a/custom_entrypoint.sh +++ b/custom_entrypoint.sh @@ -18,9 +18,7 @@ fi image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')" if version_greater "$image_version" "$installed_version"; then - rsync $rsync_options --include "/news/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ rsync $rsync_options --include "/notes/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ - rsync $rsync_options --include "/quota_warning/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ rsync $rsync_options --include "/calendar/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ rsync $rsync_options --include "/contacts/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ rsync $rsync_options --include "/user_backend_sql_raw/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ diff --git a/patches/012-remove-user-status-widget.patch b/patches/012-remove-user-status-widget.patch deleted file mode 100644 index 40e0d3a5..00000000 --- a/patches/012-remove-user-status-widget.patch +++ /dev/null @@ -1,18 +0,0 @@ -From: Akhil -Date: Fri, 17 Sep 2021 13:00 +0530 -Subject: [PATCH] Removes user status widget from Dashboard - -This patch removes user status widget from available widgets in dashboard - ---- DashboardController.php 2021-09-17 12:56:19.691685082 +0530 -+++ DashboardController-new.php 2021-09-17 12:59:18.906502554 +0530 -@@ -108,6 +108,9 @@ - 'url' => $widget->getUrl() - ]; - }, $this->dashboardManager->getWidgets()); -+ $widgets = array_filter($widgets, function($widget) { -+ return($widget['id'] !== "user_status"); -+ }); - $configStatuses = $this->config->getUserValue($this->userId, 'dashboard', 'statuses', ''); - $statuses = json_decode($configStatuses, true); - // We avoid getting an empty array as it will not produce an object in UI's JS diff --git a/patches/023-ldap-check-pwd-optimization.patch b/patches/023-ldap-check-pwd-optimization.patch new file mode 100644 index 00000000..60bbe61d --- /dev/null +++ b/patches/023-ldap-check-pwd-optimization.patch @@ -0,0 +1,59 @@ +From: Akhil +Date: Wed, 04 Jan 2023 16:24 +0530 +Subject: [PATCH] This patch optimize the ldap checkPassword function to reduce number of LDAP binds and SQL UPDATE operations per password check + +--- ./apps/user_ldap/lib/User_LDAP.php 2023-01-04 16:20:02.747181606 +0530 ++++ ./apps/user_ldap/lib/User_LDAP-new.php 2023-01-17 19:22:51.776857415 +0530 +@@ -114,11 +114,12 @@ + * @return string|false + * @throws \Exception + */ +- public function loginName2UserName($loginName) { ++ public function loginName2UserName($loginName, bool $forceLdapRefetch = false) { + $cacheKey = 'loginName2UserName-' . $loginName; + $username = $this->access->connection->getFromCache($cacheKey); + +- if ($username !== null) { ++ $ignoreCache = ($username === false && $forceLdapRefetch); ++ if ($username !== null && !$ignoreCache) { + return $username; + } + +@@ -133,6 +134,9 @@ + } + $username = $user->getUsername(); + $this->access->connection->writeToCache($cacheKey, $username); ++ if($forceLdapRefetch) { ++ $user->processAttributes($ldapRecord); ++ } + return $username; + } catch (NotOnLDAP $e) { + $this->access->connection->writeToCache($cacheKey, false); +@@ -176,16 +180,11 @@ + * @return false|string + */ + public function checkPassword($uid, $password) { +- try { +- $ldapRecord = $this->getLDAPUserByLoginName($uid); +- } catch (NotOnLDAP $e) { +- $this->logger->debug( +- $e->getMessage(), +- ['app' => 'user_ldap', 'exception' => $e] +- ); ++ $username = $this->loginName2UserName($uid, true); ++ if(!$username) { + return false; + } +- $dn = $ldapRecord['dn'][0]; ++ $dn = $this->access->username2dn($username); + $user = $this->access->userManager->get($dn); + + if (!$user instanceof User) { +@@ -203,7 +202,6 @@ + } + + $this->access->cacheUserExists($user->getUsername()); +- $user->processAttributes($ldapRecord); + $user->markLogin(); + + return $user->getUsername(); -- GitLab From 04eb52ecf381b71e97bae08e55eb83c69df8b744 Mon Sep 17 00:00:00 2001 From: AVINASH GUSAIN Date: Mon, 6 Mar 2023 16:56:33 +0000 Subject: [PATCH 13/17] nextcloud 24-0-10 --- Dockerfile | 40 ++++++++++--------- ...24-reminder-service-handle-exception.patch | 17 ++++++++ 2 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 patches/024-reminder-service-handle-exception.patch diff --git a/Dockerfile b/Dockerfile index ea1fc7e4..418dbe92 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,19 @@ -FROM nextcloud:24.0.8-fpm AS nextcloud +FROM nextcloud:24.0.10-fpm AS nextcloud ARG BASE_DIR="/usr/src/nextcloud" ARG TMP_PATCH_DIR="/tmp/build_patches" -ARG THEME_HELPER_JOB_ID="471836" +ARG THEME_HELPER_JOB_ID="515506" ARG NOTES_VERSION="4.5.1" -ARG CONTACTS_JOB_ID="471108" -ARG CALENDAR_JOB_ID="471116" -ARG EMAIL_RECOVERY_JOB_ID="445958" -ARG RAINLOOP_VERSION="7.2.5" -ARG RAINLOOP_COMMIT_SHA="28a5d603" -ARG EA_JOB_ID="471828" -ARG ECLOUD_LAUNCHER_JOB_ID="458901" -ARG GOOGLE_INTEGRATION_VERSION="1.0.8" -ARG ECLOUD_DASHBOARD_JOB_ID="485170" - -RUN sed -i 's/24,0,8,2/24,0,8,9/' ${BASE_DIR}/version.php +ARG CONTACTS_JOB_ID="525457" +ARG CALENDAR_JOB_ID="525449" +ARG EMAIL_RECOVERY_JOB_ID="525467" +ARG EA_JOB_ID="503352" +ARG ECLOUD_LAUNCHER_JOB_ID="522867" +ARG GOOGLE_INTEGRATION_VERSION="1.0.9" +ARG ECLOUD_DASHBOARD_JOB_ID="525503" +ARG SNAPPY_VERSION="2.26.3" + + +RUN sed -i 's/24,0,10,1/24,0,10,5/' ${BASE_DIR}/version.php COPY custom_entrypoint.sh / RUN chmod +x /custom_entrypoint.sh RUN mkdir -p /var/www/skeleton/Documents && mkdir -p /var/www/skeleton/Images @@ -44,11 +44,6 @@ RUN curl -fsSL -o email-recovery.zip \ mv dist/email-recovery ${BASE_DIR}/custom_apps/ && \ rm email-recovery.zip; -RUN curl -fsSL -o rainloop.tar.gz \ - "https://gitlab.e.foundation/e/infra/ecloud/nextcloud-apps/rainloop-nextcloud/-/archive/${RAINLOOP_VERSION}-${RAINLOOP_COMMIT_SHA}/rainloop-nextcloud-${RAINLOOP_VERSION}-${RAINLOOP_COMMIT_SHA}.tar.gz" && \ - tar -xf rainloop.tar.gz -C ${BASE_DIR}/custom_apps/ && \ - mv "${BASE_DIR}/custom_apps/rainloop-nextcloud-${RAINLOOP_VERSION}-${RAINLOOP_COMMIT_SHA}" "${BASE_DIR}/custom_apps/rainloop" && \ - rm rainloop.tar.gz; RUN curl -fsSL -o ecloud-theme-helper.zip \ "https://gitlab.e.foundation/e/infra/ecloud/nextcloud-apps/ecloud-theme-helper/-/jobs/${THEME_HELPER_JOB_ID}/artifacts/download" && \ @@ -80,6 +75,11 @@ RUN curl -fsSL -o ecloud-dashboard.zip \ mv dist/ecloud-dashboard ${BASE_DIR}/custom_apps/ && \ rm ecloud-dashboard.zip; +RUN curl -fsSL -o snappymail.tar.gz \ + "https://snappymail.eu/repository/nextcloud/snappymail-${SNAPPY_VERSION}-nextcloud.tar.gz" && \ + tar -xf snappymail.tar.gz -C ${BASE_DIR}/custom_apps/ && \ + rm snappymail.tar.gz; + # Remove unzip when unzipping is done RUN apt-get -y remove unzip @@ -112,6 +112,8 @@ RUN patch -u ${BASE_DIR}/core/Command/User/Setting.php -i ${TMP_PATCH_DIR}/018-o RUN patch -u ${BASE_DIR}/apps/settings/lib/Sections/Personal/Groupware.php -i ${TMP_PATCH_DIR}/019-groupware.patch RUN patch -u ${BASE_DIR}/apps/files/js/files.js -i ${TMP_PATCH_DIR}/021-repeated-storage-dialog-fix.patch RUN cd ${BASE_DIR} && patch -u ${BASE_DIR}/3rdparty/sabre/vobject/lib/ITip/Broker.php -i ${TMP_PATCH_DIR}/022-significantchange.patch +RUN patch -u ${BASE_DIR}/apps/dav/lib/CalDAV/Reminder/ReminderService.php -i ${TMP_PATCH_DIR}/024-reminder-service-handle-exception.patch + RUN rm -rf ${TMP_PATCH_DIR} # Custom theme @@ -142,7 +144,7 @@ RUN sed -i 's/update/error/g' ${BASE_DIR}/apps/dav/templates/schedule-response-e From selfhost as ecloud ARG BASE_DIR="/usr/src/nextcloud" ARG TMP_PATCH_DIR="/tmp/build_patches" -ARG THEME_VERSION="24.0.1" +ARG THEME_VERSION="24.0.3" ARG LDAP_WRITE_SUPPORT_VERSION="1.6.0" ARG OIDC_LOGIN_VERSION="2.4.0" diff --git a/patches/024-reminder-service-handle-exception.patch b/patches/024-reminder-service-handle-exception.patch new file mode 100644 index 00000000..ed5c276d --- /dev/null +++ b/patches/024-reminder-service-handle-exception.patch @@ -0,0 +1,17 @@ +--- ./apps/dav/lib/CalDAV/Reminder/ReminderService.php 2023-03-06 21:26:20.835422901 +0530 ++++ ./apps/dav/lib/CalDAV/Reminder/ReminderService-new.php 2023-03-06 21:28:49.325422185 +0530 +@@ -143,7 +143,13 @@ + continue; + } + +- $vevent = $this->getVEventByRecurrenceId($vcalendar, $reminder['recurrence_id'], $reminder['is_recurrence_exception']); ++ try { ++ $vevent = $this->getVEventByRecurrenceId($vcalendar, $reminder['recurrence_id'], $reminder['is_recurrence_exception']); ++ } catch (MaxInstancesExceededException $e) { ++ $this->logger->debug('Recurrence with too many instances detected, skipping VEVENT', ['exception' => $e]); ++ $this->backend->removeReminder($reminder['id']); ++ continue; ++ } + if (!$vevent) { + $this->backend->removeReminder($reminder['id']); + continue; -- GitLab From c045063023194189e57cbd726839e327dc495ea6 Mon Sep 17 00:00:00 2001 From: AVINASH GUSAIN Date: Tue, 7 Mar 2023 09:13:41 +0000 Subject: [PATCH 14/17] snappy-theme added --- Dockerfile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 418dbe92..0446bd1e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,9 +11,9 @@ ARG ECLOUD_LAUNCHER_JOB_ID="522867" ARG GOOGLE_INTEGRATION_VERSION="1.0.9" ARG ECLOUD_DASHBOARD_JOB_ID="525503" ARG SNAPPY_VERSION="2.26.3" +ARG SNAPPY_THEME_VERSION="1.2.2" - -RUN sed -i 's/24,0,10,1/24,0,10,5/' ${BASE_DIR}/version.php +RUN sed -i 's/24,0,10,1/24,0,10,7/' ${BASE_DIR}/version.php COPY custom_entrypoint.sh / RUN chmod +x /custom_entrypoint.sh RUN mkdir -p /var/www/skeleton/Documents && mkdir -p /var/www/skeleton/Images @@ -80,6 +80,14 @@ RUN curl -fsSL -o snappymail.tar.gz \ tar -xf snappymail.tar.gz -C ${BASE_DIR}/custom_apps/ && \ rm snappymail.tar.gz; +# Snappy theme +RUN curl -fsSL -o Murena-snappymail-theme.tar.gz \ + "https://gitlab.e.foundation/e/infra/ecloud/nextcloud-apps/snappymail-theme/-/archive/${SNAPPY_THEME_VERSION}/snappymail-theme-${SNAPPY_THEME_VERSION}.tar.gz" && \ + tar -xf Murena-snappymail-theme.tar.gz -C /tmp/ && \ + mv /tmp/snappymail-theme-${SNAPPY_THEME_VERSION}/ ${BASE_DIR}/themes/Murena && \ + chown -R www-data:www-data ${BASE_DIR}/themes/Murena/ && \ + rm -rf Murena-snappymail-theme.tar.gz + # Remove unzip when unzipping is done RUN apt-get -y remove unzip @@ -208,4 +216,3 @@ RUN rm -rf ${BASE_DIR}/themes/eCloud && \ # Seds to fix displayname save regression RUN sed -i "s/'email' ||/'email'/" ${BASE_DIR}/apps/settings/js/federationsettingsview.js RUN sed -i "s/field === 'displayname'//" ${BASE_DIR}/apps/settings/js/federationsettingsview.js - -- GitLab From f23754faf34396c8eb12a2821f663f19f79856a4 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 7 Mar 2023 17:25:02 +0530 Subject: [PATCH 15/17] ea job id updated --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0446bd1e..0541a7f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ ARG NOTES_VERSION="4.5.1" ARG CONTACTS_JOB_ID="525457" ARG CALENDAR_JOB_ID="525449" ARG EMAIL_RECOVERY_JOB_ID="525467" -ARG EA_JOB_ID="503352" +ARG EA_JOB_ID="526684" ARG ECLOUD_LAUNCHER_JOB_ID="522867" ARG GOOGLE_INTEGRATION_VERSION="1.0.9" ARG ECLOUD_DASHBOARD_JOB_ID="525503" -- GitLab From 2317291fec3ebfe193fb3df7a24be3b8fddaa6ab Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Fri, 3 Feb 2023 17:26:39 +0530 Subject: [PATCH 16/17] patch added for get by email --- patches/023-patch_getbyemail.patch | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 patches/023-patch_getbyemail.patch diff --git a/patches/023-patch_getbyemail.patch b/patches/023-patch_getbyemail.patch new file mode 100644 index 00000000..96fa4d4d --- /dev/null +++ b/patches/023-patch_getbyemail.patch @@ -0,0 +1,29 @@ +--- lib/private/User/Manager.php 2023-02-03 17:18:44.729561986 +0530 ++++ lib/private/User/Manager-new.php 2023-02-03 17:20:18.929562546 +0530 +@@ -705,16 +705,18 @@ + * @since 9.1.0 + */ + public function getByEmail($email) { +- // looking for 'email' only (and not primary_mail) is intentional +- $userIds = $this->config->getUsersForUserValueCaseInsensitive('settings', 'email', $email); ++ $uid=$email; // get first part of email if it contains alt domain, otherwise it is just $email ++ $alt_domain = $this->config->getSystemValue('alt_mail_domain', ''); ++ $alt_domain_suffix = !empty($alt_domain) ? '@' . $alt_domain : ''; + +- $users = array_map(function ($uid) { +- return $this->get($uid); +- }, $userIds); ++ if (stristr($email, $alt_domain_suffix) !== FALSE) { ++ $uid = str_replace($alt_domain_suffix, '', $email); ++ } + +- return array_values(array_filter($users, function ($u) { +- return ($u instanceof IUser); +- })); ++ if($this->get($uid)) { ++ return([$this->get($uid)]); ++ } ++ return []; + } + + private function verifyUid(string $uid): bool { -- GitLab From 1c57f8c91daa44042d303ff132d83d44ca5700cd Mon Sep 17 00:00:00 2001 From: Akhil Date: Fri, 10 Mar 2023 10:10:37 +0530 Subject: [PATCH 17/17] Rebase to fix merge conflicts --- Dockerfile | 1 + ...timize-get-by-email.patch => 025-optimize-get-by-email.patch} | 0 2 files changed, 1 insertion(+) rename patches/{023-optimize-get-by-email.patch => 025-optimize-get-by-email.patch} (100%) diff --git a/Dockerfile b/Dockerfile index 0541a7f1..e1927cd9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -165,6 +165,7 @@ RUN cd ${BASE_DIR}/custom_apps && patch -p0 < ${TMP_PATCH_DIR}/005-autocomplete- RUN patch -u ${BASE_DIR}/core/templates/layout.guest.php -i ${TMP_PATCH_DIR}/016-login-screen.patch RUN patch -u ${BASE_DIR}/lib/private/Notification/Manager.php -i ${TMP_PATCH_DIR}/020-fairuse-notification-fix.patch RUN cd ${BASE_DIR} && patch -u ${BASE_DIR}/apps/user_ldap/lib/User_LDAP.php -i ${TMP_PATCH_DIR}/023-ldap-check-pwd-optimization.patch +RUN patch -u ${BASE_DIR}/lib/private/User/Manager.php -i ${TMP_PATCH_DIR}/025-optimize-get-by-email.patch RUN rm -rf ${TMP_PATCH_DIR} RUN curl -fsSL -o ldap_write_support.tar.gz \ diff --git a/patches/023-optimize-get-by-email.patch b/patches/025-optimize-get-by-email.patch similarity index 100% rename from patches/023-optimize-get-by-email.patch rename to patches/025-optimize-get-by-email.patch -- GitLab