| | ";
if ($nr == $count - 1){
$tmp.= "";
+ "name=\"add_$nr\" $perm>";
}
if ($count > 3){
$tmp.= " |
";
+ "name=\"del_$nr\" $perm>";
}
}
$this->indexed_user[$nr]= $user;
@@ -426,7 +508,7 @@ class mailgroup extends plugin
$smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
}
if (is_numeric($this->gosaMailQuota) && $this->gosaMailQuota != 0){
- $smarty->assign("quotausage", $this->quotaUsage * 100 / $this->gosaMailQuota);
+ $smarty->assign("quotausage", progressbar(round(($this->quotaUsage * 100)/ $this->gosaMailQuota),100,15,true));
$smarty->assign("quotadefined", "true");
} else {
$smarty->assign("quotadefined", "false");
@@ -440,6 +522,14 @@ class mailgroup extends plugin
/* remove object from parent */
function remove_from_parent()
{
+ /* Added these ObjectClass and Attributes, because they were not
+ removed correctly, only in case of kolab ...
+ */
+ if(isset($this->config->current['MAILMETHOD'])&&preg_match("/kolab/i",$this->config->current['MAILMETHOD'])){
+ $this->attributes[]="acl";
+ $this->attributes[]="kolabHomeServer";
+ $this->objectclasses[] = "kolabSharedFolder";
+ }
/* include global link_info */
$ldap= $this->config->get_ldap_link();
@@ -454,7 +544,9 @@ class mailgroup extends plugin
/* Keep uid */
unset ($this->attrs['uid']);
$ldap->cd($this->dn);
- $ldap->modify($this->attrs);
+ $this->cleanup();
+$ldap->modify ($this->attrs);
+
show_ldap_error($ldap->get_error());
/* Connect to IMAP server for account deletion */
@@ -465,6 +557,7 @@ class mailgroup extends plugin
$method->deleteMailbox($this->uid);
$method->disconnect();
}
+ $method->fixAttributesOnRemove($this);
}
/* Optionally execute a command after we're done */
@@ -526,7 +619,7 @@ class mailgroup extends plugin
if (!isset($_POST["user_$nr"])){
continue;
}
- if ($_POST["user_$nr"] != $user ||
+ if ($_POST["user_$nr"] != $user ||
$_POST["perm_$nr"] != $this->indexed_acl[$nr]){
$this->is_modified= TRUE;
}
@@ -538,22 +631,35 @@ class mailgroup extends plugin
}
- /* Save data to LDAP, depending on is_account we save or delete */
+ /*
+ Backup for function save
+ Änderungen : fixAttributesOnStore($this) wurde erst nach dem this->cleanup();
+$ldap->modify
+
+ Ausgeführt, deshalb wurden die gemappten Attribute auch nicht
+ gespeichert.
+
+ Von : Fabian Hickert
+ Datum : 15.12.2005
+
+ Alter Quellcode :
+
+ /* Save data to LDAP, depending on is_account we save or delete * /
function save()
{
$ldap= $this->config->get_ldap_link();
- /* Call parents save to prepare $this->attrs */
+ /* Call parents save to prepare $this->attrs * /
plugin::save();
- /* Save arrays */
+ /* Save arrays * /
$this->attrs['gosaMailAlternateAddress']= $this->gosaMailAlternateAddress;
$this->attrs['gosaMailForwardingAddress']= $this->gosaMailForwardingAddress;
- /* Save shared folder target */
+ /* Save shared folder target * /
$this->attrs['gosaSharedFolderTarget']= "share+".$this->uid;
- /* Save acl's */
+ /* Save acl's * /
$this->attrs['acl']= array();
foreach ($this->imapacl as $user => $acl){
if ($user == ""){
@@ -562,14 +668,110 @@ class mailgroup extends plugin
$this->attrs['acl'][]= "$user $acl";
}
- /* Save data to LDAP */
+ /* Save data to LDAP * /
$ldap->cd($this->dn);
- $ldap->modify($this->attrs);
+ $this->cleanup();
+$ldap->modify ($this->attrs);
+
show_ldap_error($ldap->get_error());
- /* Only do IMAP actions if we are not a template */
+ /* Only do IMAP actions if we are not a template * /
if (!$this->is_template){
$method= new $this->method($this->config);
+ $method->fixAttributesOnStore($this);
+ if ($method->connect($this->gosaMailServer)){
+ $method->updateMailbox($this->uid);
+ $method->setQuota($this->uid, $this->gosaMailQuota);
+
+ /* Exchange '%member%' pseudo entry * /
+ $memberacl= $this->imapacl['%members%'];
+ unset ($this->imapacl['%members%']);
+ foreach ($this->members as $user){
+ if (!isset($this->imapacl[$user])){
+ $this->imapacl[$user]= $memberacl;
+ }
+ }
+
+ $method->setSharedFolderPermissions($this->uid, $this->imapacl);
+ $method->disconnect();
+ }
+ }
+
+ /* Optionally execute a command after we're done * /
+ if ($this->initially_was_account == $this->is_account){
+ if ($this->is_modified){
+ $this->handle_post_events("mofify");
+ }
+ } else {
+ $this->handle_post_events("add");
+ }
+ }
+
+ ENDE Alter Quellcode
+ */
+
+
+
+
+
+
+
+
+ /* Save data to LDAP, depending on is_account we save or delete */
+ function save()
+ {
+ $ldap= $this->config->get_ldap_link();
+
+ /* Call parents save to prepare $this->attrs */
+ plugin::save();
+
+ /* Save arrays */
+ $this->attrs['gosaMailAlternateAddress']= $this->gosaMailAlternateAddress;
+ $this->attrs['gosaMailForwardingAddress']= $this->gosaMailForwardingAddress;
+
+ /* Save shared folder target */
+ $this->attrs['gosaSharedFolderTarget']= "share+".$this->uid;
+
+ if(preg_match("/kolab/i",$this->mmethod)){
+ /* Save acl's */
+ $this->attrs['acl']= array();
+ foreach ($this->imapacl as $user => $acl){
+ if ($user == ""){
+ continue;
+ }
+ $ldap->search("(&(objectClass=person)(uid=".$user."))",array("mail"));
+ $mail = $ldap->fetch();
+ if($mail){
+ if(isset($mail['mail'][0])){
+ $this->attrs['acl'][]= $mail['mail'][0]." $acl";
+ }
+ }else{
+ $this->attrs['acl'][]= "$user $acl";
+ }
+ }
+ }else{
+ /* Save acl's */
+ $this->attrs['acl']= array();
+ foreach ($this->imapacl as $user => $acl){
+ if ($user == ""){
+ continue;
+ }
+ $this->attrs['acl'][]= "$user $acl";
+ }
+ }
+
+ /* Only do IMAP actions if we are not a template */
+ if(preg_match("/kolab/i",$this->mmethod)){
+ if (empty($this->gosaMailServer)||is_array($this->gosaMailServer)){
+ if(isset($this->attrs['gosaMailServer'][0])){
+ $this->gosaMailServer = $this->attrs['gosaMailServer'][0];
+ }
+ }
+ }
+
+ if ((!$this->is_template)&&(!empty($this->gosaMailServer))){
+ $method= new $this->method($this->config);
+ $method->fixAttributesOnStore($this);
if ($method->connect($this->gosaMailServer)){
$method->updateMailbox($this->uid);
$method->setQuota($this->uid, $this->gosaMailQuota);
@@ -582,12 +784,19 @@ class mailgroup extends plugin
$this->imapacl[$user]= $memberacl;
}
}
-
+
$method->setSharedFolderPermissions($this->uid, $this->imapacl);
$method->disconnect();
}
}
+ /* Save data to LDAP */
+ $ldap->cd($this->dn);
+ $this->cleanup();
+$ldap->modify ($this->attrs);
+
+ show_ldap_error($ldap->get_error());
+
/* Optionally execute a command after we're done */
if ($this->initially_was_account == $this->is_account){
if ($this->is_modified){
@@ -613,7 +822,7 @@ class mailgroup extends plugin
$message[]= _("Please enter a valid email addres in 'Primary address' field.");
}
$ldap->cd($this->config->current['BASE']);
- $ldap->search ("(&(|(mail=".$this->mail.")(gosaMailAlternateAddress=".
+ $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=".$this->mail.")(gosaMailAlternateAddress=".
$this->mail."))(!(uid=".$this->cn."))(!(cn=".$this->cn.")))");
if ($ldap->count() != 0){
$message[]= _("The primary address you've entered is already in use.");
@@ -642,6 +851,14 @@ class mailgroup extends plugin
$message[]= _("You need to set the maximum mail size in order to reject anything.");
}
+ if(ord($this->imapacl['anyone'][0])==194){
+ $message[] = _("Please choose valid permission settings. Default permission can't be emtpy.");
+ }
+
+ if(empty($this->gosaMailServer)){
+ $message[] = _("Please select a valid mail server.");
+ }
+
return ($message);
}