Commit ac870c83 authored by Sebastian Kummer's avatar Sebastian Kummer

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

Merge pull request #349 in ZP/z-push from bugfix/ZP-1027-can-t-move-email-to-shared-public to develop

* commit 'f2e09d59':
  ZP-1027 entryid needs to be hexed.
  ZP-1027 Fixed wording.
  ZP-1027 Switch stores before checking permissions on move destination folder.
  ZP-1027 Add warn messages if a folder can not be resolved or opened on ACL check.
parents 702201ff f2e09d59
......@@ -1575,10 +1575,16 @@ class BackendKopano implements IBackend, ISearchProvider {
*/
public function HasSecretaryACLs($store, $folderid) {
$entryid = mapi_msgstore_entryidfromsourcekey($store, hex2bin($folderid));
if (!$entryid) return false;
if (!$entryid) {
ZLog::Write(LOGLEVEL_WARN, sprintf("KopanoBackend->HasSecretaryACLs(): error, no entryid resolved for %s on store %s", $folderid, $store));
return false;
}
$folder = mapi_msgstore_openentry($store, $entryid);
if (!$folder) return false;
if (!$folder) {
ZLog::Write(LOGLEVEL_WARN, sprintf("KopanoBackend->HasSecretaryACLs(): error, could not open folder with entryid %s on store %s", bin2hex($entryid), $store));
return false;
}
$props = mapi_getprops($folder, array(PR_RIGHTS));
if (isset($props[PR_RIGHTS]) &&
......@@ -1605,10 +1611,16 @@ class BackendKopano implements IBackend, ISearchProvider {
*/
public function HasReadACLs($store, $folderid) {
$entryid = mapi_msgstore_entryidfromsourcekey($store, hex2bin($folderid));
if (!$entryid) return false;
if (!$entryid) {
ZLog::Write(LOGLEVEL_WARN, sprintf("KopanoBackend->HasReadACLs(): error, no entryid resolved for %s on store %s", $folderid, $store));
return false;
}
$folder = mapi_msgstore_openentry($store, $entryid);
if (!$folder) return false;
if (!$folder) {
ZLog::Write(LOGLEVEL_WARN, sprintf("KopanoBackend->HasReadACLs(): error, could not open folder with entryid %s on store %s", bin2hex($entryid), $store));
return false;
}
$props = mapi_getprops($folder, array(PR_RIGHTS));
if (isset($props[PR_RIGHTS]) &&
......
......@@ -397,7 +397,10 @@ class KopanoChangesWrapper implements IImportChanges, IExportChanges {
// When we setup the $current importer, we didn't know what we needed to do, so we look only at the src folder for permissions.
// Now the $newfolder could be read only as well. So we need to check it's permissions and then switch to a ReplyBackImExporter if it's r/o.
if (!$this->isReplyBackExporter()) {
if (!self::$backend->HasSecretaryACLs($this->store, $newfolder)) {
// check if the user has permissions on the destination folder
$dststore = self::$backend->GetMAPIStoreForFolderId(ZPush::GetAdditionalSyncFolderStore($newfolder), $newfolder);
if (!self::$backend->HasSecretaryACLs($dststore, $newfolder)) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("KopanoChangesWrapper->ImportMessageMove(): destination folderid '%s' is missing permissions. Switching to ReplyBackImExporter.", Utils::PrintAsString($newfolder)));
$this->replyback = $this->getReplyBackImExporter();
$this->current = $this->replyback;
......
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