From 0ca6e7c6d32b37fac3c4a692c5c3abd6cdf80b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Garc=C3=ADa=20S=C3=A1ez?= Date: Thu, 24 Sep 2015 18:56:07 +0200 Subject: [PATCH] Fix freebusy for multidomain environments When returning contacts we have to supply also the domain field. Because in a multidomain environment UIDField is unique only in the domain so an user must be identified as uid@domain. So when creating http requests from client side, we have to use uid@domain instead of only uid so the SOGoUser created on server side when parsing the requests is created properly. --- SoObjects/Contacts/SOGoContactSourceFolder.m | 8 ++++++++ UI/WebServerResources/UIxAttendeesEditor.js | 19 ++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/SoObjects/Contacts/SOGoContactSourceFolder.m b/SoObjects/Contacts/SOGoContactSourceFolder.m index e385d9c09..5f9acea4b 100644 --- a/SoObjects/Contacts/SOGoContactSourceFolder.m +++ b/SoObjects/Contacts/SOGoContactSourceFolder.m @@ -48,6 +48,7 @@ #import #import #import +#import #import #import @@ -236,6 +237,13 @@ data = @""; [newRecord setObject: data forKey: @"c_cn"]; + if ([[SOGoSystemDefaults sharedSystemDefaults] enableDomainBasedUID]) + { + data = [oldRecord objectForKey: @"c_domain"]; + if (data) + [newRecord setObject: data forKey: @"c_domain"]; + } + data = [oldRecord objectForKey: @"mail"]; if (!data) data = @""; diff --git a/UI/WebServerResources/UIxAttendeesEditor.js b/UI/WebServerResources/UIxAttendeesEditor.js index 16d297425..c33f45451 100644 --- a/UI/WebServerResources/UIxAttendeesEditor.js +++ b/UI/WebServerResources/UIxAttendeesEditor.js @@ -221,9 +221,11 @@ function performSearchCallback(http) { node.address = completeEmail; // log("node.address: " + node.address); if (contact["c_uid"]) { - node.uid = (contact["isMSExchange"]? UserLogin + ":" : "") + contact["c_uid"]; - } - else { + var login = contact["c_uid"]; + if (contact["c_domain"]) + login += "@" + contact["c_domain"]; + node.uid = (contact["isMSExchange"]? UserLogin + ":" : "") + login; + } else node.uid = null; node.appendChild(new Element('div').addClassName('colorBox').addClassName('noFreeBusy')); } @@ -275,13 +277,16 @@ function performSearchCallback(http) { else { if (document.currentPopupMenu) hideMenu(document.currentPopupMenu); - + if (data.contacts.length == 1) { // Single result var contact = data.contacts[0]; - if (contact["c_uid"]) - input.uid = (contact["isMSExchange"]? UserLogin + ":" : "") + contact["c_uid"]; - else + if (contact["c_uid"]) { + var login = contact["c_uid"]; + if (contact["c_domain"]) + login += "@" + contact["c_domain"]; + input.uid = (contact["isMSExchange"]? UserLogin + ":" : "") + login; + } else input.uid = null; var isList = (contact["c_component"] && contact["c_component"] == "vlist");