index e459411fa417855cf392df5d105de53e3d61f4bd..95ba9e5ee3e60959ddc3f6f1f8530ed910c249d9 100644 (file)
return (TRUE);
}
return (TRUE);
}
- function setSharedFolderPermissions($folder, $permissions)
+ function deleteMailbox($folder)
{
{
+ return (TRUE);
}
}
- function deleteMailbox($folder)
+
+ /* Get quota and divide it by 1024, because in gosa we display in MB
+ but we get Kb */
+ function getQuota($folder)
{
{
- return (TRUE);
+ $result= array('quotaUsage' => '', 'gosaMailQuota' => '');
+
+ error_reporting(0);
+
+ /* Load quota settings */
+ $quota_value = @imap_get_quota($this->mbox, $folder);
+ if(is_array($quota_value)) {
+ if (isset($quota_value["STORAGE"]) && is_array($quota_value["STORAGE"])){
+ /* use for PHP >= 4.3 */
+ $result['quotaUsage']= (int) ($quota_value["STORAGE"]['usage'] / 1024);
+ $result['gosaMailQuota']= (int) ($quota_value["STORAGE"]['limit'] / 1024);
+ } else {
+ /* backward icompatible */
+ $result['quotaUsage']= (int) ($quota_value['usage'] / 1024);
+ $result['gosaMailQuota']= (int) ($quota_value['limit'] / 1024);
+ }
+ }elseif(!$quota_value){
+ return(false);
+ }
+
+ error_reporting(E_ALL);
+
+ return ($result);
}
function fixAttributesOnLoad(&$mailObject)
{
}
function fixAttributesOnLoad(&$mailObject)
{
+ /* Kolab shared folder names are like ' shared.uid@server.de '
+ So overwrite uid to match these folder names. Else we can't read quota settings etc.
+ #FIXME is there a better way to detect if it is 'shared.' or 'shared+' or 'kolab+shared.' or what ever ?*/
+ $mailObject->uid = "shared.".$mailObject->uid."@".preg_replace("/^.*@/","",$mailObject->mail);
+
/* Convert attributes and objectClasses */
foreach ($this->attribute_map as $dest => $source){
/* Convert attributes and objectClasses */
foreach ($this->attribute_map as $dest => $source){
+ /* Hickert 11.11.05 : Alternate email addresses were saved, but not displayed again.
+ if (isset($mailObject->attrs[$source])){
+ $mailObject->attrs[$dest]= $mailObject->attrs[$source];
+ unset ($mailObject->attrs[$source]);
+ */
+
if (isset($mailObject->attrs[$source])){
if (isset($mailObject->attrs[$source])){
+ unset($mailObject->attrs[$source]['count']);
$mailObject->attrs[$dest]= $mailObject->attrs[$source];
$mailObject->attrs[$dest]= $mailObject->attrs[$source];
+ $mailObject->$dest= $mailObject->attrs[$source];
+
+ unset ($mailObject->$dest['count']);
unset ($mailObject->attrs[$source]);
}
}
unset ($mailObject->attrs[$source]);
}
}
- // without this line gosaMailQuota is in MB instead of KB
- $mailObject->gosaMailQuota=$mailObject->attrs['gosaMailQuota'][0];
/* Adjust server name if needed */
foreach ($mailObject->config->data['SERVERS']['IMAP'] as $srv => $dummy){
/* Adjust server name if needed */
foreach ($mailObject->config->data['SERVERS']['IMAP'] as $srv => $dummy){
function fixAttributesOnStore(&$mailObject)
{
function fixAttributesOnStore(&$mailObject)
{
+ global $config;
+
+ /* If quota is empty, remove quota restrictions by setting quota to 0 */
+ if(isset($mailObject->gosaMailQuota) && (empty($mailObject->gosaMailQuota))){
+ $mailObject->attrs['gosaMailQuota'] = 0;
+ }
+
/* Convert attributes and objectClasses */
foreach ($this->attribute_map as $source => $dest){
if (isset($mailObject->attrs[$source])){
/* Convert attributes and objectClasses */
foreach ($this->attribute_map as $source => $dest){
if (isset($mailObject->attrs[$source])){
}
$objectclasses= array();
foreach ($mailObject->attrs['objectClass'] as $oc){
}
$objectclasses= array();
foreach ($mailObject->attrs['objectClass'] as $oc){
- if ($oc != 'kolabInetOrgPerson'){
+ if ($oc != 'kolabInetOrgPerson' && $oc != 'kolabSharedFolder'){
$objectclasses[]= $oc;
}
}
$objectclasses[]= $oc;
}
}
-
- $mailObject->attrs['gosaMailQuota'] = ( $mailObject->gosaMailQuota/1024);
-
$mailObject->attrs['objectClass']= $objectclasses;
$mailObject->attrs['objectClass']= $objectclasses;
- $mailObject->attrs['objectClass'][]= 'kolabInetOrgPerson';
+ if (in_array("posixGroup", $mailObject->attrs['objectClass'])){
+
+ /* Add kolabSharedFoleder Class */
+ $mailObject->attrs['objectClass'][]= 'kolabSharedFolder';
+
+ /* Work on acl attribute */
+ $new_acl= array();
+ foreach ($mailObject->attrs['acl'] as $uacl){
+
+ /* Get user=(mail) & acls */
+ list($user, $acl) = split(" ", $uacl);
+
+ /* Add al users which have seperated acls
+ %members% are all users in this group,
+ which have the standard group acl
+ */
+ if ($user != "%members%"){
+ $new_acl[$user]= $uacl;
+ } else {
+
+ /* All groupmembers will be added */
+ $ldap = $config->get_ldap_link();
+ $ldap->cd($config->current['BASE']);
+ foreach ($mailObject->members as $member){
+
+ /* Get user mail address .... */
+ $ldap->search("(&(objectClass=person)(|(uid=".$member.")(mail=".$member.")))",array("mail"));
+ $res = $ldap->fetch();
+
+ /* Default mail address is set to uid -
+ So if there is no mail address defined the uid is added
+ */
+ $mail = $member;
+
+ /* Use mail address if it is available */
+ if(isset($res['mail'][0])){
+ $mail = $res['mail'][0];
+ }
+
+ /* only append this mail/permission string to acl,
+ if there arn't already some (special) configs for this user */
+ $found =false;
+ foreach($mailObject->imapacl as $mailA => $acl){
+ if(strtolower(trim($mailA))==strtolower(trim($mail))){
+ $found = true;
+ }
+ }
+
+ /* Skipp user, with no email adress too */
+ if($member == $mail){
+ $found = true;
+ }
+
+ /* Append new user acl */
+ if(!$found){
+ $new_acl[$member]= "$mail $acl";
+ }
+
+ /* Old line */
+ // $new_acl[$member]= "$member $acl";
+ }
+ }
+ }
+
+ /* Save shared folder target */
+ $mailObject->attrs['gosaSharedFolderTarget']= "kolab+shared.".$mailObject->uid;
+
+ /* Kolab shared folder names are like ' shared.uid@server.de '
+ So overwrite uid to match these folder names. Else we can't read quota settings etc.
+ #FIXME is there a better way to detect if it is 'shared.' or 'shared+' or 'kolab+shared.' or what ever ?*/
+ $mailObject->uid = "shared.".$mailObject->uid."@".preg_replace("/^.*@/","",$mailObject->mail);
+
+ /* Assign new acls */
+ $mailObject->attrs['acl']= array();
+ foreach ($new_acl as $key => $value){
+ $mailObject->attrs['acl'][]= $value;
+ }
+ } else {
+ $mailObject->attrs['objectClass'][]= 'kolabInetOrgPerson';
+ }
/* Remove imap:// tagging */
$mailObject->attrs['kolabHomeServer']= preg_replace('%imap://%', '', $mailObject->attrs['kolabHomeServer']);
/* Remove imap:// tagging */
$mailObject->attrs['kolabHomeServer']= preg_replace('%imap://%', '', $mailObject->attrs['kolabHomeServer']);
$mailObject->attrs['kolabDeleteFlag']= array();
}
$mailObject->attrs['kolabDeleteFlag']= array();
}
-
function fixAttributesOnRemove(&$mailObject)
{
/* Add attribute for object deletion and remove GOsa specific
values from entry. */
function fixAttributesOnRemove(&$mailObject)
{
/* Add attribute for object deletion and remove GOsa specific
values from entry. */
- unset ($mailObject->attrs['mail']);
+ foreach($this->attribute_map as $kolabAttr){
+ $mailObject->attrs[$kolabAttr] = array();
+ }
$mailObject->attrs['kolabDeleteFlag']= preg_replace('%imap://%', '', $mailObject->gosaMailServer);
}
$mailObject->attrs['kolabDeleteFlag']= preg_replace('%imap://%', '', $mailObject->gosaMailServer);
}