From: hzerres Date: Tue, 23 Nov 2010 16:14:40 +0000 (+0000) Subject: (libgroupware) worked on setMember Acls for folders. Correct call - server refuses... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3b5ada4fa6972fbdc96796983516e7c1e54a38d6;p=gosa.git (libgroupware) worked on setMember Acls for folders. Correct call - server refuses to work. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20343 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/groupware/personal/groupware/class_Groupware.inc b/gosa-plugins/groupware/personal/groupware/class_Groupware.inc index 99a2f6e74..72b6a64da 100644 --- a/gosa-plugins/groupware/personal/groupware/class_Groupware.inc +++ b/gosa-plugins/groupware/personal/groupware/class_Groupware.inc @@ -331,7 +331,8 @@ class Groupware extends plugin else{ $this->mailFolderChanges = $this->FolderWidget->save(); } - $this->folderSave(); + + $this->folderSave($this->uid); $this->FolderWidget = NULL; } } @@ -899,9 +900,10 @@ class Groupware extends plugin } } - // Save account folders + // TODO: Check the following paragraph + // Save account folders if($this->mailFolder !== NULL && $this->isFeatureEnabled("mailFolder") && $this->hasFeaturebeenChanged("mailFolder")){ - $res = $this->saveFoldersAndAcls($this->uid, $this->mailFolder); + //$res = $this->saveFoldersAndAcls($this->uid, $this->mailFolder); if($res === NULL){ $message = _("Saving mail folder failed!"); msg_dialog::display(_("Error"),$message."
".sprintf(_("Error was: '%s'."),$this->rpcErrorMessage),ERROR_DIALOG); @@ -975,11 +977,11 @@ class Groupware extends plugin } //Remove the root folder - the widget adds it as new - echo "Removing: user/".$this->uid; unset($this->mailFolderChanges["user/".$this->uid]); foreach($this->mailFolderChanges as $folder => $memberlist){ - echo "Status".$this->mailFolderChanges[$folder]["status"]."
"; + echo "Status: ".$this->mailFolderChanges[$folder]["status"]."
"; + if($this->mailFolderChanges[$folder]["status"] == "added"){ $this->groupwareDao->save("mailFolder", $folder); } @@ -987,27 +989,41 @@ class Groupware extends plugin $this->groupwareDao->del("mailFolder", $folder); } + $memberListToBeSaved = array(); if($this->isFeatureEnabled("folderACLs")){ //checking if ACL has been changed. if($this->mailFolderChanges[$folder]["status"] == "added"){ if(isset($memberlist["acls"])){ - echo "DEBUG HAPE- Changing ACLs Folder".$folder."
"; //set Default ACLs if not yet set by User $defAcls = GroupwareDefinitions::getDefaultFolderACLs(); - $memberListToBeSaved = array_merge($defAcls, $memberlist["acls"] ); + $memberListToBeSaved = $defAcls; + //append all mebers set in Gosa widget. + foreach($memberlist["acls"] as $member){ + $memberListToBeSaved[$member["name"]] = $member["acl"]; + } } } else{ - if(array_differs($memberlist["acls"], $this->mailFolderChanges[$folder]["acls"])){ - echo "DEBUG HAPE- Changing ACLs Folder".$folder."
"; - $memberListToBeSaved = array_merge($memberlist["acls"]); + echo "--- Hello1"; + print_a($memberlist["acls"]); + echo "--- Hello2"; + print_a($this->mailFolderChanges[$folder]["acls"]); + + if(array_differs($memberlist["acls"], $this->mailFolder[$folder]["acls"])){ + //append all mebers set in Gosa widget. + echo "ACLs have changed."; + foreach($memberlist["acls"] as $member){ + $memberListToBeSaved[$member["name"]] = $member["acl"]; + } } } - echo "
";
-					print_r($memberListToBeSaved);
-					echo "
"; - $this->groupwareDao->save("folderACLs", $this->uid, array($memberListToBeSaved)); + if(!empty($memberListToBeSaved)){ + echo "List To save:
";
+						print_r($memberListToBeSaved);
+						echo "

"; + $this->groupwareDao->save("folderACLs", $folder, array($memberListToBeSaved)); + } } } } @@ -1068,8 +1084,8 @@ class Groupware extends plugin $messages[] = _("The primary address cannot be used as forwarding address!"); } } - } - } + } + } //checks for feature "mailLimit" - integer if ($this->isFeatureEnabled("mailLimit")){ @@ -1131,7 +1147,6 @@ class Groupware extends plugin # //checks for feature "alternateAddresses" # if ($this->isFeatureEnabled("alternateAddresses")){} - return($messages); } @@ -1155,6 +1170,7 @@ class Groupware extends plugin "mailFolder" => _("Mail folder"), "quotaUsage" => _("Quota usage"), "mailFilter" => _("Mail filter"), + "mailFilter" => _("Mail filter"), "quotaSize" => _("Quota size"), "alternateAddresses" => _("Alternate mail addresses"), "forwardingAddresses" => _("Forwarding mail addresses"), @@ -1216,9 +1232,7 @@ class Groupware extends plugin /*! \brief This is a feature with many datasets inside which should be - * cut in slices and saved separately. - */ - // + function saveFoldersAndAcls($id, $mailFolder) { // In the tests with the exchange server groupware setting acls is very @@ -1240,6 +1254,7 @@ class Groupware extends plugin } return($res); } + */ } diff --git a/gosa-plugins/groupware/personal/groupware/class_GroupwareDao.inc b/gosa-plugins/groupware/personal/groupware/class_GroupwareDao.inc index dfc0b0763..a5c5e6f4f 100644 --- a/gosa-plugins/groupware/personal/groupware/class_GroupwareDao.inc +++ b/gosa-plugins/groupware/personal/groupware/class_GroupwareDao.inc @@ -106,7 +106,6 @@ class GroupwareDao{ $valueArray = array($function, $uid, $valueArray); } else{ - //omit otherwise $valueArray = array($function, $uid); } @@ -203,8 +202,10 @@ class GroupwareDao{ $resultArr["primaryMail"] = $comp["primaryMail"]; $resultArr["alternateAddresses"] = $comp["alternateAddresses"]; - $resultArr["forwardingAddresses"] = array(key($comp["forwardingAddresses"])); - var_dump($resultArr["forwardingAddresses"]); + //This dao will only accept the first forwardingAddress. + $resultArr["forwardingAddresses"] = array(key($comp["forwardingAddresses"])); + var_dump($resultArr["forwardingAddresses"]); + $resultArr["mailLocation"] = $comp["mailLocation"]; //Quota things. $resultArr["quotaSize"] = $comp["quota"]["usage"]; @@ -337,7 +338,7 @@ class GroupwareDao{ $resultArr["mailBoxSendSizelimitEnabled"] = TRUE; $resultArr["mailBoxSendSizelimitValue"] = $quota["send_limit"]; }else{ - $resultArr["mailBoxSendSizelimitEnabled"] = FALSE; + $resultArr["mailBoxSendSizelimitEnabled"] = FALSE; } if($quota["hard_limit"] > 0){ $resultArr["mailBoxHardSizelimitEnabled"] = TRUE; @@ -372,8 +373,8 @@ class GroupwareDao{ $resultArr["vacationEnabled"] = !empty($resultArr["vacationMessage"]); } return $resultArr; - } + } /* \brief Translates Groupware folderAcls to Gosa widget Acls. * @return Array list of Groupware Members with rights to folders.