Commit 881fc1f3 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-989 Output current permission flags on all additional folders in

AdditionalFolderList(), criteria to add a shared folder in the
ChangesMemoryWrapper should always be on the read only flag, refixed
typo in Kopano backend.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 1ae288e3
...@@ -238,7 +238,7 @@ class BackendKopano implements IBackend, ISearchProvider { ...@@ -238,7 +238,7 @@ class BackendKopano implements IBackend, ISearchProvider {
if ($user === false) if ($user === false)
$user = $this->mainUser; $user = $this->mainUser;
// This is a special case. A user will get it's entire folder structure by the foldersync by default. // This is a special case. A user will get his entire folder structure by the foldersync by default.
// The ACL check is executed when an additional folder is going to be sent to the mobile. // The ACL check is executed when an additional folder is going to be sent to the mobile.
// Configured that way the user could receive the same folderid twice, with two different names. // Configured that way the user could receive the same folderid twice, with two different names.
if ($this->mainUser == $user && $checkACLonly && $folderid) { if ($this->mainUser == $user && $checkACLonly && $folderid) {
......
...@@ -78,7 +78,8 @@ class ChangesMemoryWrapper extends HierarchyCache implements IImportChanges, IEx ...@@ -78,7 +78,8 @@ class ChangesMemoryWrapper extends HierarchyCache implements IImportChanges, IEx
foreach($state as $addKey => $addFolder) { foreach($state as $addKey => $addFolder) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ChangesMemoryWrapper->Config(AdditionalFolders) : process folder '%s'", $addFolder->displayname)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("ChangesMemoryWrapper->Config(AdditionalFolders) : process folder '%s'", $addFolder->displayname));
if (isset($addFolder->NoBackendFolder) && $addFolder->NoBackendFolder == true) { if (isset($addFolder->NoBackendFolder) && $addFolder->NoBackendFolder == true) {
$hasRights = ZPush::GetBackend()->Setup($addFolder->Store, true, $addFolder->BackendId, $addFolder->ReadOnly); // check rights for readonly access only
$hasRights = ZPush::GetBackend()->Setup($addFolder->Store, true, $addFolder->BackendId, true);
// delete the folder on the device // delete the folder on the device
if (! $hasRights) { if (! $hasRights) {
// delete the folder only if it was an additional folder before, else ignore it // delete the folder only if it was an additional folder before, else ignore it
......
...@@ -168,6 +168,15 @@ class WebserviceDevice { ...@@ -168,6 +168,15 @@ class WebserviceDevice {
$deviceId = preg_replace("/[^A-Za-z0-9]/", "", $deviceId); $deviceId = preg_replace("/[^A-Za-z0-9]/", "", $deviceId);
$folders = ZPushAdmin::AdditionalFolderList($user, $deviceId); $folders = ZPushAdmin::AdditionalFolderList($user, $deviceId);
ZLog::Write(LOGLEVEL_INFO, sprintf("WebserviceDevice::AdditionalFolderList(): found %d folders for device '%s' of user '%s'", count($folders), $deviceId, $user)); ZLog::Write(LOGLEVEL_INFO, sprintf("WebserviceDevice::AdditionalFolderList(): found %d folders for device '%s' of user '%s'", count($folders), $deviceId, $user));
// retrieve the permission flags from the backend
$backend = ZPush::GetBackend();
foreach($folders as &$folder) {
$folder['readable'] = $backend->Setup($folder['store'], true, $folder['folderid'], true);
$folder['writeable'] = $backend->Setup($folder['store'], true, $folder['folderid']);
}
// make sure folder is not pointing to our last folder anymore
unset($folder);
ZPush::GetTopCollector()->AnnounceInformation(sprintf("Retrieved details of %d folders", count($folders)), true); ZPush::GetTopCollector()->AnnounceInformation(sprintf("Retrieved details of %d folders", count($folders)), true);
return $folders; return $folders;
......
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