Commit 1ae288e3 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-989 Reverted: "Remove readonly parameter from backends' Setup() function. Check"

This reverts commit e632b0e4.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 1e545605
...@@ -134,12 +134,13 @@ class BackendCombined extends Backend implements ISearchProvider { ...@@ -134,12 +134,13 @@ class BackendCombined extends Backend implements ISearchProvider {
* @param string $store target store, could contain a "domain\user" value * @param string $store target store, could contain a "domain\user" value
* @param boolean $checkACLonly if set to true, Setup() should just check ACLs * @param boolean $checkACLonly if set to true, Setup() should just check ACLs
* @param string $folderid if set, only ACLs on this folderid are relevant * @param string $folderid if set, only ACLs on this folderid are relevant
* @param boolean $readonly if set, the folder needs at least read permissions
* *
* @access public * @access public
* @return boolean * @return boolean
*/ */
public function Setup($store, $checkACLonly = false, $folderid = false) { public function Setup($store, $checkACLonly = false, $folderid = false, $readonly = false) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("Combined->Setup('%s', '%s', '%s')", $store, Utils::PrintAsString($checkACLonly), $folderid)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("Combined->Setup('%s', '%s', '%s', '%s')", $store, Utils::PrintAsString($checkACLonly), $folderid, Utils::PrintAsString($readonly)));
if(!is_array($this->backends)){ if(!is_array($this->backends)){
return false; return false;
} }
...@@ -148,7 +149,7 @@ class BackendCombined extends Backend implements ISearchProvider { ...@@ -148,7 +149,7 @@ class BackendCombined extends Backend implements ISearchProvider {
if(isset($this->config['backends'][$i]['users']) && isset($this->config['backends'][$i]['users'][$store]['username'])){ if(isset($this->config['backends'][$i]['users']) && isset($this->config['backends'][$i]['users'][$store]['username'])){
$u = $this->config['backends'][$i]['users'][$store]['username']; $u = $this->config['backends'][$i]['users'][$store]['username'];
} }
if($this->backends[$i]->Setup($u, $checkACLonly, $folderid) == false){ if($this->backends[$i]->Setup($u, $checkACLonly, $folderid, $readonly) == false){
ZLog::Write(LOGLEVEL_WARN, "Combined->Setup() failed"); ZLog::Write(LOGLEVEL_WARN, "Combined->Setup() failed");
return false; return false;
} }
......
...@@ -224,11 +224,12 @@ class BackendKopano implements IBackend, ISearchProvider { ...@@ -224,11 +224,12 @@ class BackendKopano implements IBackend, ISearchProvider {
* @param string $store target store, could contain a "domain\user" value * @param string $store target store, could contain a "domain\user" value
* @param boolean $checkACLonly if set to true, Setup() should just check ACLs * @param boolean $checkACLonly if set to true, Setup() should just check ACLs
* @param string $folderid if set, only ACLs on this folderid are relevant * @param string $folderid if set, only ACLs on this folderid are relevant
* @param boolean $readonly if set, the folder needs at least read permissions
* *
* @access public * @access public
* @return boolean * @return boolean
*/ */
public function Setup($store, $checkACLonly = false, $folderid = false) { public function Setup($store, $checkACLonly = false, $folderid = false, $readonly = false) {
list($user, $domain) = Utils::SplitDomainUser($store); list($user, $domain) = Utils::SplitDomainUser($store);
if (!isset($this->mainUser)) if (!isset($this->mainUser))
...@@ -237,7 +238,7 @@ class BackendKopano implements IBackend, ISearchProvider { ...@@ -237,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 his entire folder structure by the foldersync by default. // This is a special case. A user will get it's 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) {
...@@ -265,11 +266,15 @@ class BackendKopano implements IBackend, ISearchProvider { ...@@ -265,11 +266,15 @@ class BackendKopano implements IBackend, ISearchProvider {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("KopanoBackend->Setup(): Checking for admin ACLs on store '%s': '%s'", $user, Utils::PrintAsString($admin))); ZLog::Write(LOGLEVEL_DEBUG, sprintf("KopanoBackend->Setup(): Checking for admin ACLs on store '%s': '%s'", $user, Utils::PrintAsString($admin)));
return $admin; return $admin;
} }
// check for read permission on this folder // check permissions on this folder
// check for write permission is not necessary here else {
if (! $readonly) {
$rights = $this->HasSecretaryACLs($userstore, $folderid);
}
else { else {
$rights = $this->HasReadACLs($userstore, $folderid); $rights = $this->HasReadACLs($userstore, $folderid);
ZLog::Write(LOGLEVEL_DEBUG, sprintf("KopanoBackend->Setup(): Checking for ACLs on '%s' of store '%s': '%s'", $folderid, $user, Utils::PrintAsString($rights))); }
ZLog::Write(LOGLEVEL_DEBUG, sprintf("KopanoBackend->Setup(): Checking for '%s' ACLs on '%s' of store '%s': '%s'", ($readonly?'read':'secretary'), $folderid, $user, Utils::PrintAsString($rights)));
return $rights; return $rights;
} }
} }
......
...@@ -78,7 +78,7 @@ class ChangesMemoryWrapper extends HierarchyCache implements IImportChanges, IEx ...@@ -78,7 +78,7 @@ 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); $hasRights = ZPush::GetBackend()->Setup($addFolder->Store, true, $addFolder->BackendId, $addFolder->ReadOnly);
// 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
......
...@@ -105,7 +105,7 @@ abstract class Backend implements IBackend { ...@@ -105,7 +105,7 @@ abstract class Backend implements IBackend {
* Methods to be implemented * Methods to be implemented
* *
* public function Logon($username, $domain, $password); * public function Logon($username, $domain, $password);
* public function Setup($store, $checkACLonly = false, $folderid = false); * public function Setup($store, $checkACLonly = false, $folderid = false, $readonly = false);
* public function Logoff(); * public function Logoff();
* public function GetHierarchy(); * public function GetHierarchy();
* public function GetImporter($folderid = false); * public function GetImporter($folderid = false);
......
...@@ -69,11 +69,12 @@ abstract class BackendDiff extends Backend { ...@@ -69,11 +69,12 @@ abstract class BackendDiff extends Backend {
* @param string $store target store, could contain a "domain\user" value * @param string $store target store, could contain a "domain\user" value
* @param boolean $checkACLonly if set to true, Setup() should just check ACLs * @param boolean $checkACLonly if set to true, Setup() should just check ACLs
* @param string $folderid if set, only ACLs on this folderid are relevant * @param string $folderid if set, only ACLs on this folderid are relevant
* @param boolean $readonly if set, the folder needs at least read permissions
* *
* @access public * @access public
* @return boolean * @return boolean
*/ */
public function Setup($store, $checkACLonly = false, $folderid = false) { public function Setup($store, $checkACLonly = false, $folderid = false, $readonly = false) {
$this->store = $store; $this->store = $store;
// we don't know if and how diff backends implement the "admin" check, but this will disable it for the webservice // we don't know if and how diff backends implement the "admin" check, but this will disable it for the webservice
......
...@@ -102,11 +102,12 @@ interface IBackend { ...@@ -102,11 +102,12 @@ interface IBackend {
* @param string $store target store, could contain a "domain\user" value * @param string $store target store, could contain a "domain\user" value
* @param boolean $checkACLonly if set to true, Setup() should just check ACLs * @param boolean $checkACLonly if set to true, Setup() should just check ACLs
* @param string $folderid if set, only ACLs on this folderid are relevant * @param string $folderid if set, only ACLs on this folderid are relevant
* @param boolean $readonly if set, the folder needs at least read permissions
* *
* @access public * @access public
* @return boolean * @return boolean
*/ */
public function Setup($store, $checkACLonly = false, $folderid = false); public function Setup($store, $checkACLonly = false, $folderid = false, $readonly = false);
/** /**
* Logs off * Logs off
......
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