Commit 58749c06 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #322 in ZP/z-push from...

Merge pull request #322 in ZP/z-push from bugfix/ZP-996-webserviceinfo--listuserfolders-does to develop

* commit 'e97d2f0c':
  ZP-996 WebserviceInfo->ListUserFolders() does not work correctly for the public folder. Made GetStoreProps() in mapiprovider public.
parents e68275f4 e97d2f0c
...@@ -339,8 +339,16 @@ class BackendKopano implements IBackend, ISearchProvider { ...@@ -339,8 +339,16 @@ class BackendKopano implements IBackend, ISearchProvider {
public function GetHierarchy() { public function GetHierarchy() {
$folders = array(); $folders = array();
$mapiprovider = new MAPIProvider($this->session, $this->store); $mapiprovider = new MAPIProvider($this->session, $this->store);
$storeProps = $mapiprovider->GetStoreProps();
// for SYSTEM user open the public folders
if (strtoupper($this->storeName) == "SYSTEM") {
$rootfolder = mapi_msgstore_openentry($this->store, $storeProps[PR_IPM_PUBLIC_FOLDERS_ENTRYID]);
}
else {
$rootfolder = mapi_msgstore_openentry($this->store);
}
$rootfolder = mapi_msgstore_openentry($this->store);
$rootfolderprops = mapi_getprops($rootfolder, array(PR_SOURCE_KEY)); $rootfolderprops = mapi_getprops($rootfolder, array(PR_SOURCE_KEY));
$hierarchy = mapi_folder_gethierarchytable($rootfolder, CONVENIENT_DEPTH); $hierarchy = mapi_folder_gethierarchytable($rootfolder, CONVENIENT_DEPTH);
...@@ -350,8 +358,9 @@ class BackendKopano implements IBackend, ISearchProvider { ...@@ -350,8 +358,9 @@ class BackendKopano implements IBackend, ISearchProvider {
// do not display hidden and search folders // do not display hidden and search folders
if ((isset($row[PR_ATTR_HIDDEN]) && $row[PR_ATTR_HIDDEN]) || if ((isset($row[PR_ATTR_HIDDEN]) && $row[PR_ATTR_HIDDEN]) ||
(isset($row[PR_FOLDER_TYPE]) && $row[PR_FOLDER_TYPE] == FOLDER_SEARCH) || (isset($row[PR_FOLDER_TYPE]) && $row[PR_FOLDER_TYPE] == FOLDER_SEARCH) ||
(isset($row[PR_PARENT_SOURCE_KEY]) && $row[PR_PARENT_SOURCE_KEY] == $rootfolderprops[PR_SOURCE_KEY]) ) { // for SYSTEM user $row[PR_PARENT_SOURCE_KEY] == $rootfolderprops[PR_SOURCE_KEY] is true, but we need those folders
continue; (isset($row[PR_PARENT_SOURCE_KEY]) && $row[PR_PARENT_SOURCE_KEY] == $rootfolderprops[PR_SOURCE_KEY] && strtoupper($this->storeName) != "SYSTEM")) {
continue;
} }
$folder = $mapiprovider->GetFolder($row); $folder = $mapiprovider->GetFolder($row);
if ($folder) { if ($folder) {
...@@ -363,7 +372,8 @@ class BackendKopano implements IBackend, ISearchProvider { ...@@ -363,7 +372,8 @@ class BackendKopano implements IBackend, ISearchProvider {
$dm = ZPush::GetDeviceManager(); $dm = ZPush::GetDeviceManager();
foreach ($folders as $folder) { foreach ($folders as $folder) {
if ($folder->parentid !== "0") { if ($folder->parentid !== "0") {
$folder->parentid = $dm->GetFolderIdForBackendId($folder->parentid); // SYSTEM user's parentid points to $rootfolderprops[PR_SOURCE_KEY], but they need to be on the top level
$folder->parentid = (strtoupper($this->storeName) == "SYSTEM" && $folder->parentid == bin2hex($rootfolderprops[PR_SOURCE_KEY])) ? '0' : $dm->GetFolderIdForBackendId($folder->parentid);
} }
} }
......
...@@ -280,7 +280,7 @@ class MAPIProvider { ...@@ -280,7 +280,7 @@ class MAPIProvider {
} }
//set attendee's status and type if they're available and if we are the organizer //set attendee's status and type if they're available and if we are the organizer
$storeprops = $this->getStoreProps(); $storeprops = $this->GetStoreProps();
if (isset($row[PR_RECIPIENT_TRACKSTATUS]) && $messageprops[$appointmentprops["representingentryid"]] == $storeprops[PR_MAILBOX_OWNER_ENTRYID]) if (isset($row[PR_RECIPIENT_TRACKSTATUS]) && $messageprops[$appointmentprops["representingentryid"]] == $storeprops[PR_MAILBOX_OWNER_ENTRYID])
$attendee->attendeestatus = $row[PR_RECIPIENT_TRACKSTATUS]; $attendee->attendeestatus = $row[PR_RECIPIENT_TRACKSTATUS];
if (isset($row[PR_RECIPIENT_TYPE])) if (isset($row[PR_RECIPIENT_TYPE]))
...@@ -852,7 +852,7 @@ class MAPIProvider { ...@@ -852,7 +852,7 @@ class MAPIProvider {
public function GetFolder($folderprops) { public function GetFolder($folderprops) {
$folder = new SyncFolder(); $folder = new SyncFolder();
$storeprops = $this->getStoreProps(); $storeprops = $this->GetStoreProps();
// For ZCP 7.0.x we need to retrieve more properties explicitly, see ZP-780 // For ZCP 7.0.x we need to retrieve more properties explicitly, see ZP-780
if (isset($folderprops[PR_SOURCE_KEY]) && !isset($folderprops[PR_ENTRYID]) && !isset($folderprops[PR_CONTAINER_CLASS])) { if (isset($folderprops[PR_SOURCE_KEY]) && !isset($folderprops[PR_ENTRYID]) && !isset($folderprops[PR_CONTAINER_CLASS])) {
...@@ -919,7 +919,7 @@ class MAPIProvider { ...@@ -919,7 +919,7 @@ class MAPIProvider {
* @return long * @return long
*/ */
public function GetFolderType($entryid, $class = false) { public function GetFolderType($entryid, $class = false) {
$storeprops = $this->getStoreProps(); $storeprops = $this->GetStoreProps();
$inboxprops = $this->getInboxProps(); $inboxprops = $this->getInboxProps();
if($entryid == $storeprops[PR_IPM_WASTEBASKET_ENTRYID]) if($entryid == $storeprops[PR_IPM_WASTEBASKET_ENTRYID])
...@@ -1344,7 +1344,7 @@ class MAPIProvider { ...@@ -1344,7 +1344,7 @@ class MAPIProvider {
$representingprops = $this->getProps($mapimessage, $p); $representingprops = $this->getProps($mapimessage, $p);
if (!isset($representingprops[$appointmentprops["representingentryid"]])) { if (!isset($representingprops[$appointmentprops["representingentryid"]])) {
// TODO use getStoreProps // TODO use GetStoreProps
$storeProps = mapi_getprops($this->store, array(PR_MAILBOX_OWNER_ENTRYID)); $storeProps = mapi_getprops($this->store, array(PR_MAILBOX_OWNER_ENTRYID));
$props[$appointmentprops["representingentryid"]] = $storeProps[PR_MAILBOX_OWNER_ENTRYID]; $props[$appointmentprops["representingentryid"]] = $storeProps[PR_MAILBOX_OWNER_ENTRYID];
$displayname = $this->getFullnameFromEntryID($storeProps[PR_MAILBOX_OWNER_ENTRYID]); $displayname = $this->getFullnameFromEntryID($storeProps[PR_MAILBOX_OWNER_ENTRYID]);
...@@ -2734,9 +2734,9 @@ class MAPIProvider { ...@@ -2734,9 +2734,9 @@ class MAPIProvider {
* @access private * @access private
* @return array * @return array
*/ */
private function getStoreProps() { public function GetStoreProps() {
if (!isset($this->storeProps) || empty($this->storeProps)) { if (!isset($this->storeProps) || empty($this->storeProps)) {
ZLog::Write(LOGLEVEL_DEBUG, "MAPIProvider->getStoreProps(): Getting store properties."); ZLog::Write(LOGLEVEL_DEBUG, "MAPIProvider->GetStoreProps(): Getting store properties.");
$this->storeProps = mapi_getprops($this->store, array(PR_IPM_SUBTREE_ENTRYID, PR_IPM_OUTBOX_ENTRYID, PR_IPM_WASTEBASKET_ENTRYID, PR_IPM_SENTMAIL_ENTRYID, PR_ENTRYID, PR_IPM_PUBLIC_FOLDERS_ENTRYID, PR_IPM_FAVORITES_ENTRYID, PR_MAILBOX_OWNER_ENTRYID)); $this->storeProps = mapi_getprops($this->store, array(PR_IPM_SUBTREE_ENTRYID, PR_IPM_OUTBOX_ENTRYID, PR_IPM_WASTEBASKET_ENTRYID, PR_IPM_SENTMAIL_ENTRYID, PR_ENTRYID, PR_IPM_PUBLIC_FOLDERS_ENTRYID, PR_IPM_FAVORITES_ENTRYID, PR_MAILBOX_OWNER_ENTRYID));
// make sure all properties are set // make sure all properties are set
if(!isset($this->storeProps[PR_IPM_WASTEBASKET_ENTRYID])) { if(!isset($this->storeProps[PR_IPM_WASTEBASKET_ENTRYID])) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment