Commit e632b0e4 authored by Manfred Kutas's avatar Manfred Kutas

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

for only read permission in Kopano backend Setup().

Released under the Affero GNU General Public License (AGPL) version 3.
parent 19824533
......@@ -134,13 +134,12 @@ class BackendCombined extends Backend implements ISearchProvider {
* @param string $store target store, could contain a "domain\user" value
* @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 boolean $readonly if set, the folder needs at least read permissions
*
* @access public
* @return boolean
*/
public function Setup($store, $checkACLonly = false, $folderid = false, $readonly = false) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("Combined->Setup('%s', '%s', '%s', '%s')", $store, Utils::PrintAsString($checkACLonly), $folderid, Utils::PrintAsString($readonly)));
public function Setup($store, $checkACLonly = false, $folderid = false) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("Combined->Setup('%s', '%s', '%s')", $store, Utils::PrintAsString($checkACLonly), $folderid));
if(!is_array($this->backends)){
return false;
}
......@@ -149,7 +148,7 @@ class BackendCombined extends Backend implements ISearchProvider {
if(isset($this->config['backends'][$i]['users']) && isset($this->config['backends'][$i]['users'][$store]['username'])){
$u = $this->config['backends'][$i]['users'][$store]['username'];
}
if($this->backends[$i]->Setup($u, $checkACLonly, $folderid, $readonly) == false){
if($this->backends[$i]->Setup($u, $checkACLonly, $folderid) == false){
ZLog::Write(LOGLEVEL_WARN, "Combined->Setup() failed");
return false;
}
......
......@@ -224,12 +224,11 @@ class BackendKopano implements IBackend, ISearchProvider {
* @param string $store target store, could contain a "domain\user" value
* @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 boolean $readonly if set, the folder needs at least read permissions
*
* @access public
* @return boolean
*/
public function Setup($store, $checkACLonly = false, $folderid = false, $readonly = false) {
public function Setup($store, $checkACLonly = false, $folderid = false) {
list($user, $domain) = Utils::SplitDomainUser($store);
if (!isset($this->mainUser))
......@@ -238,7 +237,7 @@ class BackendKopano implements IBackend, ISearchProvider {
if ($user === false)
$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.
// Configured that way the user could receive the same folderid twice, with two different names.
if ($this->mainUser == $user && $checkACLonly && $folderid) {
......@@ -266,15 +265,11 @@ class BackendKopano implements IBackend, ISearchProvider {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("KopanoBackend->Setup(): Checking for admin ACLs on store '%s': '%s'", $user, Utils::PrintAsString($admin)));
return $admin;
}
// check permissions on this folder
// check for read permission on this folder
// check for write permission is not necessary here
else {
if (! $readonly) {
$rights = $this->HasSecretaryACLs($userstore, $folderid);
}
else {
$rights = $this->HasReadACLs($userstore, $folderid);
}
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)));
$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)));
return $rights;
}
}
......
......@@ -78,7 +78,7 @@ class ChangesMemoryWrapper extends HierarchyCache implements IImportChanges, IEx
foreach($state as $addKey => $addFolder) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ChangesMemoryWrapper->Config(AdditionalFolders) : process folder '%s'", $addFolder->displayname));
if (isset($addFolder->NoBackendFolder) && $addFolder->NoBackendFolder == true) {
$hasRights = ZPush::GetBackend()->Setup($addFolder->Store, true, $addFolder->BackendId, $addFolder->ReadOnly);
$hasRights = ZPush::GetBackend()->Setup($addFolder->Store, true, $addFolder->BackendId);
// delete the folder on the device
if (! $hasRights) {
// delete the folder only if it was an additional folder before, else ignore it
......
......@@ -105,7 +105,7 @@ abstract class Backend implements IBackend {
* Methods to be implemented
*
* public function Logon($username, $domain, $password);
* public function Setup($store, $checkACLonly = false, $folderid = false, $readonly = false);
* public function Setup($store, $checkACLonly = false, $folderid = false);
* public function Logoff();
* public function GetHierarchy();
* public function GetImporter($folderid = false);
......
......@@ -69,12 +69,11 @@ abstract class BackendDiff extends Backend {
* @param string $store target store, could contain a "domain\user" value
* @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 boolean $readonly if set, the folder needs at least read permissions
*
* @access public
* @return boolean
*/
public function Setup($store, $checkACLonly = false, $folderid = false, $readonly = false) {
public function Setup($store, $checkACLonly = false, $folderid = false) {
$this->store = $store;
// we don't know if and how diff backends implement the "admin" check, but this will disable it for the webservice
......
......@@ -102,12 +102,11 @@ interface IBackend {
* @param string $store target store, could contain a "domain\user" value
* @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 boolean $readonly if set, the folder needs at least read permissions
*
* @access public
* @return boolean
*/
public function Setup($store, $checkACLonly = false, $folderid = false, $readonly = false);
public function Setup($store, $checkACLonly = false, $folderid = false);
/**
* 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