Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e8528ac4 authored by Nivesh Krishna's avatar Nivesh Krishna
Browse files

Merge branch 'main' into 'dev/selfhost-snappy-icons'

# Conflicts:
#   Dockerfile
parents 2c7c2ec8 5e3d2640
Loading
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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"
ARG SNAPPY_THEME_VERSION="1.2.3"

RUN sed -i 's/24,0,10,1/24,0,10,9/' ${BASE_DIR}/version.php
RUN sed -i 's/24,0,10,1/24,0,10,10/' ${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
@@ -152,7 +152,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.3"
ARG THEME_VERSION="24.0.4"
ARG LDAP_WRITE_SUPPORT_VERSION="1.6.0"
ARG OIDC_LOGIN_VERSION="2.4.0"

@@ -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 \
+3 −2
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ if version_greater "$image_version" "$installed_version"; then
    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/
    rsync $rsync_options --include "/rainloop/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/
    rsync $rsync_options --include "/email-recovery/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/
    rsync $rsync_options --include "/ecloud-accounts/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/
    rsync $rsync_options --include "/ecloud-theme-helper/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/
@@ -31,7 +30,9 @@ if version_greater "$image_version" "$installed_version"; then
    rsync $rsync_options --include "/ldap_write_support/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/
    rsync $rsync_options --include "/oidc_login/" --exclude '/*' $SRC_DIR/custom_apps/ /$DST_DIR/custom_apps/
    rsync $rsync_options --include "/ecloud-dashboard/" --exclude '/*' $SRC_DIR/custom_apps/ /$DST_DIR/custom_apps/
    rsync $rsync_options --include "/snappymail/" --exclude '/*' $SRC_DIR/custom_apps/ /$DST_DIR/custom_apps/
    rsync $rsync_options --include "/eCloud/" --exclude '/*' $SRC_DIR/themes/ $DST_DIR/themes/
    rsync $rsync_options --include "/Murena/" --exclude '/*' $SRC_DIR/themes/ $DST_DIR/themes/
else
    echo "Skipping rsync step as version not updated!"
fi
+44 −0
Original line number Diff line number Diff line
From: Akhil <akhil@e.email>
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);