diff --git a/store/conf/attrs/zimbra-attrs.xml b/store/conf/attrs/zimbra-attrs.xml index 0b926cf65ba..a4b67ba8045 100644 --- a/store/conf/attrs/zimbra-attrs.xml +++ b/store/conf/attrs/zimbra-attrs.xml @@ -10474,7 +10474,7 @@ TODO: delete them permanently from here Define body: field for 2FA email in html format - + When set to True, all aliases will be hidden for particular account diff --git a/store/src/java/com/zimbra/cs/account/ldap/LdapProvisioning.java b/store/src/java/com/zimbra/cs/account/ldap/LdapProvisioning.java index f792bef4832..8e8713e92d6 100644 --- a/store/src/java/com/zimbra/cs/account/ldap/LdapProvisioning.java +++ b/store/src/java/com/zimbra/cs/account/ldap/LdapProvisioning.java @@ -11729,14 +11729,13 @@ public String sendMdmEmail(String status, String timeInterval) throws ServiceExc @Override - public void excludePrivateAliases(NamedEntry entry, List aliases) throws ServiceException { + public void excludePrivateAliases(NamedEntry entry, List emailAndAliases) throws ServiceException { LdapUsage ldapUsage = LdapUsage.GAL_SEARCH; ZLdapContext zlc = LdapClient.getContext(LdapServerType.MASTER, ldapUsage); - for (String alias : new ArrayList<>(aliases)) { - + for (String alias : new ArrayList<>( emailAndAliases.subList( 1, emailAndAliases.size()))) { // exclude primay email here if (null != alias) { String parts[] = alias.split("@"); String aliasName = parts[0]; @@ -11752,15 +11751,15 @@ public void excludePrivateAliases(NamedEntry entry, List aliases) throws Alias aliasEntryLocal = makeAlias(aliasDn, attrs); - NamedEntry targetEntry = searchAliasTarget(aliasEntryLocal, false); + //NamedEntry targetEntry = searchAliasTarget(aliasEntryLocal, false); - boolean isSame = (entry.getId().equals(targetEntry.getId())); + // boolean isSame = (entry.getId().equals(targetEntry.getId())); if ("TRUE".equalsIgnoreCase(aliasEntryLocal.getAttr(Provisioning.A_zimbraHideAliasInGal))) { - aliases.remove(alias); + emailAndAliases.remove(alias); } ZimbraLog.mailbox.info("alias attribute for %s is %s and isSame %s ", alias, - aliasEntryLocal.getAttr(Provisioning.A_zimbraHideAliasInGal), isSame); + aliasEntryLocal.getAttr(Provisioning.A_zimbraHideAliasInGal), true); } } } diff --git a/store/src/java/com/zimbra/cs/mailbox/ContactAutoComplete.java b/store/src/java/com/zimbra/cs/mailbox/ContactAutoComplete.java index c09df982462..923aa39a991 100644 --- a/store/src/java/com/zimbra/cs/mailbox/ContactAutoComplete.java +++ b/store/src/java/com/zimbra/cs/mailbox/ContactAutoComplete.java @@ -710,7 +710,7 @@ public void addMatchedContacts(String query, Map attrs displayName = Joiner.on(' ').skipNulls().join(first, middle, last); } - List allowedEmailsList = new ArrayList<>(); + List allowedEmailsListInGalAutocomplete = new ArrayList<>(); for(String emailKey: mEmailKeys) { if (!emailKey.equals(Constants.PRIMARY_EMAIL)) { //check if all aliases of an account need to be bypassed @@ -718,15 +718,18 @@ public void addMatchedContacts(String query, Map attrs break; } } - allowedEmailsList.add(getFieldAsString(attrs, emailKey)); + String email = getFieldAsString(attrs, emailKey); + if(null != email) { + allowedEmailsListInGalAutocomplete.add(email); + } } - ZimbraLog.mailbox.info("allowed list 1 is %s", allowedEmailsList); + ZimbraLog.mailbox.info("allowed list 1 is %s", allowedEmailsListInGalAutocomplete); - Provisioning.getInstance().excludePrivateAliases(account, allowedEmailsList.subList( 1, allowedEmailsList.size())); + Provisioning.getInstance().excludePrivateAliases(account, allowedEmailsListInGalAutocomplete); - ZimbraLog.mailbox.info("allowed list 2 is %s", allowedEmailsList); + ZimbraLog.mailbox.info("allowed list 2 is %s", allowedEmailsListInGalAutocomplete); - for (String email : allowedEmailsList) { + for (String email : allowedEmailsListInGalAutocomplete) { if (email != null && (nameMatches || matchesEmail(tokens, email))) { ContactEntry entry = new ContactEntry(); entry.mEmail = email;