index f759f74357bf8fa70cff38a486f9090bb86df315..31557a6c4c12aa858266cacd3f4ca4826feddfa5 100644 (file)
class mailgroup extends plugin
{
/* CLI vars */
class mailgroup extends plugin
{
/* CLI vars */
- var $cli_summary= "Manage mail groups/shared folders";
- var $cli_description= "Some longer text\nfor help";
- var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
- var $method= "mailMethod";
-
- /* plugin specific values */
- var $mail= "";
- var $uid= "";
- var $cn= "";
- var $gosaMailAlternateAddress= array();
- var $gosaMailForwardingAddress= array();
- var $gosaMailDeliveryMode= "[L ]";
- var $gosaMailServer= "";
- var $gosaMailQuota= "";
- var $gosaMailMaxSize= "";
- var $gosaVacationMessage= "";
- var $gosaSpamSortLevel= "";
- var $gosaSpamMailbox= "";
-
- var $quotaUsage= 0;
- var $forward_dialog= FALSE;
- var $members= array();
- var $mailusers= array();
- var $perms= array();
- var $imapacl= array('anyone' => 'p', '%members%' => 'lrsp', '' => 'p');
- var $mmethod= "";
+ var $cli_summary = "Manage mail groups/shared folders";
+ var $cli_description = "Some longer text\nfor help";
+ var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+ var $uid = ""; // User id
+ var $cn = ""; // cn
+
+ var $method = "mailMethod"; // Used Mail method
+ var $mmethod = ""; // Contains the gosa.conf MAILMETHOD
+ var $mail = ""; // Default mail address
+
+ var $gosaMailAlternateAddress = array(); // Set default Alternate Mail Adresses to empty array
+ var $gosaMailForwardingAddress = array(); // Forwarding also empty
+
+ var $gosaMailServer = ""; // Selected mailserver
+ var $gosaMailQuota = ""; // Defined Quota
+ var $quotaUsage = 0; // Currently used quota
+
+ var $gosaVacationMessage = ""; // Vocation message
+
+ var $imapacl = array('anyone' => 'p', // Set acls for everyone
+ '%members%' => 'lrsp', // %members% are all group-members
+ '' => 'p'); // Every user added gets this right
+
+
+ var $gosaSpamSortLevel = "";
+ var $gosaSpamMailbox = "";
+ var $gosaSharedFolderTarget ;
+
+ var $forward_dialog = FALSE;
+
+ var $members = array(); // Group members
+
+ var $mailusers = array();
+ var $perms = array();
+ var $gosaMailDeliveryMode = "[L ]"; //
+ var $gosaMailMaxSize = ""; //
+
/* Helper */
var $indexed_acl= array();
var $indexed_user= array();
/* attribute list for save action */
/* Helper */
var $indexed_acl= array();
var $indexed_user= array();
/* attribute list for save action */
- var $attributes= array("mail", "gosaMailServer", "gosaMailQuota", "gosaMailMaxSize",
+ var $attributes= array( "mail", "gosaMailServer", "gosaMailQuota", "gosaMailMaxSize",
+ "gosaMailAlternateAddress", "gosaMailForwardingAddress",
"gosaMailDeliveryMode", "gosaSpamSortLevel", "gosaSpamMailbox",
"gosaMailDeliveryMode", "gosaSpamSortLevel", "gosaSpamMailbox",
- "gosaVacationMessage");
+ "acl","gosaSharedFolderTarget", "gosaVacationMessage");
+
var $objectclasses= array("gosaMailAccount");
var $objectclasses= array("gosaMailAccount");
- /* constructor, if 'dn' is set, the node loads the given
- 'dn' from LDAP */
- function mailgroup ($config, $dn= NULL, $ui= NULL)
+ function mailgroup ($config, $dn= NULL, $parent= NULL)
{
{
- /* Configuration is fine, allways */
- $this->config= $config;
-
- /* Load bases attributes */
- plugin::plugin($config, $dn);
+ /* Initialise all available attributes ... if possible
+ */
+ plugin::plugin($config, $dn, $parent);
- /* Set mailMethod to the one defined in gosa.conf */
+ /* Set mailMethod to the one defined in gosa.conf
+ */
if (isset($this->config->current['MAILMETHOD'])){
$this->mmethod= $this->config->current['MAILMETHOD'];
}
if (isset($this->config->current['MAILMETHOD'])){
$this->mmethod= $this->config->current['MAILMETHOD'];
}
-
+
+ /* Check if selected mail method exists
+ */
if (class_exists("mailMethod$this->mmethod")){
$this->method= "mailMethod$this->mmethod";
} else {
print_red(sprintf(_("There is no mail method '%s' specified in your gosa.conf available."), $this->mmethod));
}
if (class_exists("mailMethod$this->mmethod")){
$this->method= "mailMethod$this->mmethod";
} else {
print_red(sprintf(_("There is no mail method '%s' specified in your gosa.conf available."), $this->mmethod));
}
- /* Load Mailserver string, only in case of kolab ???? */
- if(preg_match("/kolab/i",$this->mmethod)){
- if(isset($this->attrs['gosaMailServer'][0])){
- $this->gosaMailServer = $this->attrs['gosaMailServer'][0];
- }
- }
+ /* Load Mailserver
+ */
+ if(isset($this->attrs['gosaMailServer'][0])){
+ $this->gosaMailServer = $this->attrs['gosaMailServer'][0];
+ }
- /* Convert cn to uid in case of existing entries */
+ /* Convert cn to uid in case of existing entry
+ */
if (isset($this->attrs['cn'][0])){
$this->uid= $this->attrs['cn'][0];
}
if (isset($this->attrs['cn'][0])){
$this->uid= $this->attrs['cn'][0];
}
- if ($dn != NULL){
- /* Load attributes containing arrays */
+ /* If this ins't new mailgroup, read all required data from ldap
+ */
+ if (($dn != "new")&&($dn != NULL)){
+
+ /* Load attributes which represent multiple entries
+ */
foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
+ $this->$val = array();
if (isset($this->attrs["$val"]["count"])){
for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
array_push($this->$val, $this->attrs["$val"][$i]);
if (isset($this->attrs["$val"]["count"])){
for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
array_push($this->$val, $this->attrs["$val"][$i]);
}
}
}
}
- /* Only do IMAP actions if gosaMailServer attribute is set */
+ /* Only do IMAP actions if gosaMailServer attribute is set
+ */
if (isset ($this->attrs["gosaMailServer"][0])){
if (isset ($this->attrs["gosaMailServer"][0])){
+
+ /* Create new instance of our defined mailclass
+ */
$method= new $this->method($this->config);
$method= new $this->method($this->config);
+
if ($method->connect($this->attrs["gosaMailServer"][0])){
if ($method->connect($this->attrs["gosaMailServer"][0])){
- $quota= $method->getQuota($this->uid);
+
/* Maybe the entry is not saved in new style, get
permissions from IMAP and convert them to acl attributes */
/* Maybe the entry is not saved in new style, get
permissions from IMAP and convert them to acl attributes */
/* Highest count wins as %members%, remove all members
with the same acl */
/* Highest count wins as %members%, remove all members
with the same acl */
- $this->imapacl['%members%']= $leader;
+ if(!empty($leader)){
+ $this->imapacl['%members%']= $leader;
+ }
foreach ($this->imapacl as $user => $acl){
if ($this->acl == $leader && in_array($user, $this->attrs['memberUid'])){
unset($this->imapacl[$user]);
}
}
foreach ($this->imapacl as $user => $acl){
if ($this->acl == $leader && in_array($user, $this->attrs['memberUid'])){
unset($this->imapacl[$user]);
}
}
- }
+ } // ENDE ! isset ($this->attrs['acl'])
+
+ /* Adapt attributes if needed */
+ $method->fixAttributesOnLoad($this);
+
+ /* get Quota */
+ $quota= $method->getQuota($this->uid);
/* Update quota values */
/* Update quota values */
- if ($quota['gosaMailQuota'] == 2147483647){
- $this->quotaUsage= "";
- $this->gosaMailQuota= "";
- } else {
- $this->quotaUsage= $quota['quotaUsage'];
- $this->gosaMailQuota= $quota['gosaMailQuota'];
+ if(is_array($quota)){
+ if ($quota['gosaMailQuota'] == 2147483647){
+ $this->quotaUsage= "";
+ $this->gosaMailQuota= "";
+ } else {
+ $this->quotaUsage= $quota['quotaUsage'];
+ $this->gosaMailQuota= $quota['gosaMailQuota'];
+ }
+ }else{
+ $this->quotaUsage = "";
+ $this->gosaMailQuota = "";
+// print_red(sprintf(_("Can't get quota information for '%s'."),$this->uid));
}
$method->disconnect();
}
$method->disconnect();
- }
+ } // ENDE $method->connect($this->attrs["gosaMailServer"][0])){
+
+ } // ENDE gosaMailServer
+
+ } // ENDE dn != "new"
- /* Adapt attributes if needed */
- $method->fixAttributesOnLoad($this);
- }
- }
/* Get global filter config */
if (!is_global("gmailfilter")){
/* Get global filter config */
if (!is_global("gmailfilter")){
$tmp = array();
if(preg_match("/kolab/i",$this->mmethod)){
$ldap = $this->config->get_ldap_link();
$tmp = array();
if(preg_match("/kolab/i",$this->mmethod)){
$ldap = $this->config->get_ldap_link();
+
if (isset($this->attrs['acl'])){
if (isset($this->attrs['acl'])){
+
for ($i= 0; $i<$this->attrs['acl']['count']; $i++){
list($user, $permission)= split(' ', $this->attrs['acl'][$i]);
for ($i= 0; $i<$this->attrs['acl']['count']; $i++){
list($user, $permission)= split(' ', $this->attrs['acl'][$i]);
/* Get all user permissions sorted by acl, to detect the most used acl
This acl is then used for %members%
/* Get all user permissions sorted by acl, to detect the most used acl
This acl is then used for %members%
- */
- $tmp[$permission][] = $user;
+ */
+ if ($user != "anyone" && $user != "%members%"){
+ $tmp[$permission][] = $user;
+ }
/* There is an entry in $this->imapacl like this this ...
/* There is an entry in $this->imapacl like this this ...
- $this->attrs['imapacl']['anyone'] = "p";
- $this->attrs['imapacl']['%members%'] = "lprs";
- $this->attrs['imapacl'][''] = ""; <------ This is used to diplay an empty
- Field for special acls in our template.
- If there is at least one special acl in out imapacl,
- we don't need this entry anymore, because it is already displayed.
- */
+ $this->attrs['imapacl']['anyone'] = "p";
+ $this->attrs['imapacl']['%members%'] = "lprs";
+ $this->attrs['imapacl'][''] = ""; <------ This is used to diplay an empty
+ Field for special acls in our template.
+ If there is at least one special acl in out imapacl,
+ we don't need this entry anymore, because it is already displayed.
+ */
if ($user != "anyone" && $user != "%members%"){
unset($this->imapacl['']);
}
if ($user != "anyone" && $user != "%members%"){
unset($this->imapacl['']);
}
/* In this section we dectect which acl is tho most used
This will be used as %members% acl
/* In this section we dectect which acl is tho most used
This will be used as %members% acl
- */
+ */
$tmp2 = array();
foreach($tmp as $acl => $user){
$tmp2[count($tmp[$acl])]=$acl;
}
$tmp2 = array();
foreach($tmp as $acl => $user){
$tmp2[count($tmp[$acl])]=$acl;
}
- /* Most used at last */
+ /* Most used at last
+ */
ksort($tmp2);
ksort($tmp2);
-
- /* Assign last (most used acl) to %members% acl */
- $this->imapacl['%members%']=array_pop($tmp2);
+
+ /* Assign last (most used acl) to %members% acl
+ */
+ $str = array_pop($tmp2);
+ if(!empty($str)) {
+ $this->imapacl['%members%']=$str;
+ }
- /* Open ldap connection */
+ /* Open ldap connection
+ */
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
foreach($this->imapacl as $mail => $permission){
$ldap->search("(&(objectClass=person)(mail=".$mail."))",array("uid"));
$atr = $ldap->fetch();
foreach($this->imapacl as $mail => $permission){
$ldap->search("(&(objectClass=person)(mail=".$mail."))",array("uid"));
$atr = $ldap->fetch();
- if((isset($atr['uid'][0]))&&(in_array($atr['uid'][0],$this->attrs['memberUid']))&&($permission == $this->imapacl['%members%'])){
- unset($this->imapacl[$mail]);
+ if((isset($this->attrs['memberUid'])) && (is_array($this->attrs['memberUid']))){
+ if((isset($atr['uid'][0]))&&(in_array($atr['uid'][0],$this->attrs['memberUid']))&&($permission == $this->imapacl['%members%'])){
+ unset($this->imapacl[$mail]);
+ }
}
}
}
}
-
/* Append an empty entry, for special acl handling */
if(count($this->imapacl)==2){
$this->imapacl[''] ="";
}
/* Append an empty entry, for special acl handling */
if(count($this->imapacl)==2){
$this->imapacl[''] ="";
}
- }else{
+
+ }else{ // Not kolab
/* Load permissions */
if (isset($this->attrs['acl'])){
for ($i= 0; $i<$this->attrs['acl']['count']; $i++){
/* Load permissions */
if (isset($this->attrs['acl'])){
for ($i= 0; $i<$this->attrs['acl']['count']; $i++){
}
}
}
}
}
}
+
+ /* Load Mailserver
+ */
+ if(isset($this->attrs['gosaMailServer'][0])){
+ $this->gosaMailServer = $this->attrs['gosaMailServer'][0];
+ }
/* Fill translations */
$this->perms["lrs"]= _("read");
$this->perms["lrsp"]= _("post");
/* Fill translations */
$this->perms["lrs"]= _("read");
$this->perms["lrsp"]= _("post");
$this->perms["lrswipcd"]= _("write");
}
$this->perms["lrswipcd"]= _("write");
}
-
function execute()
{
/* Call parent execute */
function execute()
{
/* Call parent execute */
}
$acl= array($this->config->current['BASE'] => ":all");
}
$acl= array($this->config->current['BASE'] => ":all");
- $res= get_list($acl, "(&(objectClass=gosaMailAccount)$filter)", TRUE, $gmailfilter['depselect'], array("sn", "mail", "givenName"), TRUE);
+ $res= get_list("(&(objectClass=gosaMailAccount)$filter)", $acl, $gmailfilter['depselect'],
+ array("sn", "mail", "givenName"), GL_SUBSEARCH | GL_SIZELIMIT);
$ldap->cd($gmailfilter['depselect']);
$ldap->search ("(&(objectClass=gosaMailAccount)$filter)", array("sn", "mail", "givenName"));
error_reporting (0);
$ldap->cd($gmailfilter['depselect']);
$ldap->search ("(&(objectClass=gosaMailAccount)$filter)", array("sn", "mail", "givenName"));
error_reporting (0);
foreach($this->imapacl as $user => $acl){
if ($user != "anyone" && $user != "%members%"){
$tmp.= "<tr><td><input name=\"user_$nr\" size=20 maxlength=60 ".
foreach($this->imapacl as $user => $acl){
if ($user != "anyone" && $user != "%members%"){
$tmp.= "<tr><td><input name=\"user_$nr\" size=20 maxlength=60 ".
- "value=\"$user\" $perm></td><td><select size=\"1\" name=\"perm_$nr\" $perm>";
+ "value=\"$user\" $perm></td><td><select size=\"1\" name=\"perm_$nr\" $perm>";
foreach ($this->perms as $key => $value){
if ($acl == $key){
$tmp.= "<option value=$key selected>$value</option>";
foreach ($this->perms as $key => $value){
if ($acl == $key){
$tmp.= "<option value=$key selected>$value</option>";
$tmp.= "</select> ";
if ($nr == $count - 1){
$tmp.= "<input type=submit value=\""._("Add")."\" ".
$tmp.= "</select> ";
if ($nr == $count - 1){
$tmp.= "<input type=submit value=\""._("Add")."\" ".
- "name=\"add_$nr\" $perm>";
+ "name=\"add_$nr\" $perm>";
}
if ($count > 3){
$tmp.= "<input type=submit value=\""._("Remove")."\" ".
}
if ($count > 3){
$tmp.= "<input type=submit value=\""._("Remove")."\" ".
- "name=\"del_$nr\" $perm></td></tr>";
+ "name=\"del_$nr\" $perm></td></tr>";
}
}
$this->indexed_user[$nr]= $user;
}
}
$this->indexed_user[$nr]= $user;
$smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
}
if (is_numeric($this->gosaMailQuota) && $this->gosaMailQuota != 0){
$smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
}
if (is_numeric($this->gosaMailQuota) && $this->gosaMailQuota != 0){
- $smarty->assign("quotausage", progressbar(round(($this->quotaUsage * 100)/ $this->gosaMailQuota,100,15,true)));
+ $smarty->assign("quotausage", progressbar(round(($this->quotaUsage * 100)/ $this->gosaMailQuota),100,15,true));
$smarty->assign("quotadefined", "true");
} else {
$smarty->assign("quotadefined", "false");
$smarty->assign("quotadefined", "true");
} else {
$smarty->assign("quotadefined", "false");
/* Added these ObjectClass and Attributes, because they were not
removed correctly, only in case of kolab ...
*/
/* Added these ObjectClass and Attributes, because they were not
removed correctly, only in case of kolab ...
*/
- if(preg_match("/kolab/i",$this->config->current['MAILMETHOD'])){
+ if(isset($this->config->current['MAILMETHOD'])&&preg_match("/kolab/i",$this->config->current['MAILMETHOD'])){
$this->attributes[]="acl";
$this->attributes[]="acl";
- $this->attributes[]="kolabHomeServer";
$this->objectclasses[] = "kolabSharedFolder";
}
/* include global link_info */
$this->objectclasses[] = "kolabSharedFolder";
}
/* include global link_info */
$this->attrs['gosaMailForwardingAddress']= array();
$this->attrs['gosaSharedFolderTarget']= array();
$this->attrs['gosaMailForwardingAddress']= array();
$this->attrs['gosaSharedFolderTarget']= array();
- /* Keep uid */
- unset ($this->attrs['uid']);
- $ldap->cd($this->dn);
- $ldap->modify($this->attrs);
- show_ldap_error($ldap->get_error());
-
/* Connect to IMAP server for account deletion */
/* Connect to IMAP server for account deletion */
- if ($this->is_account){
+ if ($this->initially_was_account){
$method= new $this->method($this->config);
$method= new $this->method($this->config);
- if ($method->connect($this->attrs["gosaMailServer"][0])){
+ if ($method->connect($this->gosaMailServer)){
/* Remove account from IMAP server */
$method->deleteMailbox($this->uid);
$method->disconnect();
}
$method->fixAttributesOnRemove($this);
}
/* Remove account from IMAP server */
$method->deleteMailbox($this->uid);
$method->disconnect();
}
$method->fixAttributesOnRemove($this);
}
+ /* Keep uid */
+ unset ($this->attrs['uid']);
+
+
+ $ldap->cd($this->dn);
+ $ldap->modify ($this->attrs);
+ show_ldap_error($ldap->get_error(), _("Removing group mail settings failed"));
/* Optionally execute a command after we're done */
$this->handle_post_events("remove");
/* Optionally execute a command after we're done */
$this->handle_post_events("remove");
we're in some other dialog.
Example for gosaMailDeliveryMode [LR ]
we're in some other dialog.
Example for gosaMailDeliveryMode [LR ]
- L: Local delivery
- R: Reject when exceeding mailsize limit
- S: Use spam filter
- V: Use vacation message
- C: Use custom sieve script
- I: Only insider delivery */
+L: Local delivery
+R: Reject when exceeding mailsize limit
+S: Use spam filter
+V: Use vacation message
+C: Use custom sieve script
+I: Only insider delivery */
if (isset($_POST['mailedit'])){
/* Save ldap attributes */
if (isset($_POST['mailedit'])){
/* Save ldap attributes */
}
}
- /*
- Backup for function save
- Änderungen : fixAttributesOnStore($this) wurde erst nach dem 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 * /
- plugin::save();
-
- /* Save arrays * /
- $this->attrs['gosaMailAlternateAddress']= $this->gosaMailAlternateAddress;
- $this->attrs['gosaMailForwardingAddress']= $this->gosaMailForwardingAddress;
-
- /* Save shared folder target * /
- $this->attrs['gosaSharedFolderTarget']= "share+".$this->uid;
-
- /* Save acl's * /
- $this->attrs['acl']= array();
- foreach ($this->imapacl as $user => $acl){
- if ($user == ""){
- continue;
- }
- $this->attrs['acl'][]= "$user $acl";
- }
-
- /* Save data to LDAP * /
- $ldap->cd($this->dn);
- $ldap->modify($this->attrs);
- show_ldap_error($ldap->get_error());
-
- /* 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();
/* Save data to LDAP, depending on is_account we save or delete */
function save()
{
$ldap= $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
/* Call parents save to prepare $this->attrs */
plugin::save();
/* Save arrays */
/* 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;
+ $this->attrs['gosaMailAlternateAddress'] = $this->gosaMailAlternateAddress;
+ $this->attrs['gosaMailForwardingAddress'] = $this->gosaMailForwardingAddress;
+ $this->attrs['gosaSharedFolderTarget'] = "share+".$this->uid;
if(preg_match("/kolab/i",$this->mmethod)){
/* Save acl's */
if(preg_match("/kolab/i",$this->mmethod)){
/* Save acl's */
if ($user == ""){
continue;
}
if ($user == ""){
continue;
}
- $ldap->search("(&(objectClass=person)(uid=".$user."))",array("mail"));
+ $ldap->search("(&(objectClass=person)(|(uid=".$user.")(mail=".$user.")))",array("mail"));
$mail = $ldap->fetch();
if($mail){
if(isset($mail['mail'][0])){
$mail = $ldap->fetch();
if($mail){
if(isset($mail['mail'][0])){
}
}
}
}
}
}
-
+
+
if ((!$this->is_template)&&(!empty($this->gosaMailServer))){
$method= new $this->method($this->config);
$method->fixAttributesOnStore($this);
if ((!$this->is_template)&&(!empty($this->gosaMailServer))){
$method= new $this->method($this->config);
$method->fixAttributesOnStore($this);
- if ($method->connect($this->gosaMailServer)){
+ if (($method->connect($this->gosaMailServer))){
$method->updateMailbox($this->uid);
$method->setQuota($this->uid, $this->gosaMailQuota);
$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();
}
}
$method->setSharedFolderPermissions($this->uid, $this->imapacl);
$method->disconnect();
}
}
+ /* Exchange '%member%' pseudo entry */
+ $memberacl= $this->imapacl['%members%'];
+
+ foreach ($this->members as $user){
+ if(preg_match("/kolab/i",$this->mmethod)){
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->search("(&(objectClass=person)(|(mail=".$user.")(uid=".$user.")))",array("mail"));
+ $at = $ldap->fetch();
+ if(isset($at['mail'][0])){
+ $user = $at['mail'][0];
+ }
+ }
+ if (!isset($this->imapacl[$user])){
+ $this->imapacl[$user]= $memberacl;
+ }
+ }
+ $this->attrs['acl'] = array();
+ foreach($this->imapacl as $user => $acl){
+ if(preg_match("/%members%/",$user) || empty($user)) continue;
+
+ $this->attrs['acl'][] = $user." ".$acl;
+ }
+
/* Save data to LDAP */
$ldap->cd($this->dn);
/* Save data to LDAP */
$ldap->cd($this->dn);
- $ldap->modify($this->attrs);
- show_ldap_error($ldap->get_error());
+ $this->cleanup();
+ $ldap->modify ($this->attrs);
+ show_ldap_error($ldap->get_error(), _("Saving group mail settings failed"));
/* Optionally execute a command after we're done */
if ($this->initially_was_account == $this->is_account){
if ($this->is_modified){
/* 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");
+ $this->handle_post_events("modify");
}
} else {
$this->handle_post_events("add");
}
} else {
$this->handle_post_events("add");
{
$ldap= $this->config->get_ldap_link();
{
$ldap= $this->config->get_ldap_link();
- $message= array();
+ /* Call common method to give check the hook */
+ $message= plugin::check();
+
+ if(!$this->is_account) return array();
+
+ //$message[] = $str;
/* must: mail */
if ($this->mail == ""){
/* must: mail */
if ($this->mail == ""){
if ($ldap->count() != 0){
$message[]= _("The primary address you've entered is already in use.");
}
if ($ldap->count() != 0){
$message[]= _("The primary address you've entered is already in use.");
}
-
+
/* Check quota */
if ($this->gosaMailQuota != '' && chkacl ($this->acl, "gosaMailQuota") == ""){
if (!is_numeric($this->gosaMailQuota)) {
/* Check quota */
if ($this->gosaMailQuota != '' && chkacl ($this->acl, "gosaMailQuota") == ""){
if (!is_numeric($this->gosaMailQuota)) {
function delForwarder($addresses)
{
$this->gosaMailForwardingAddress= array_remove_entries ($addresses,
function delForwarder($addresses)
{
$this->gosaMailForwardingAddress= array_remove_entries ($addresses,
- $this->gosaMailForwardingAddress);
+ $this->gosaMailForwardingAddress);
$this->is_modified= TRUE;
}
$this->is_modified= TRUE;
}
function delAlternate($addresses)
{
$this->gosaMailAlternateAddress= array_remove_entries ($addresses,
function delAlternate($addresses)
{
$this->gosaMailAlternateAddress= array_remove_entries ($addresses,
- $this->gosaMailAlternateAddress);
+ $this->gosaMailAlternateAddress);
$this->is_modified= TRUE;
}
$this->is_modified= TRUE;
}
return ($name);
}
return ($name);
}
+ function getCopyDialog()
+ {
+ if(!$this->is_account) return("");
+
+ $smarty = get_smarty();
+ $smarty->assign("gosaMailAlternateAddress",$this->gosaMailAlternateAddress);
+ $smarty->assign("gosaMailForwardingAddress",$this->gosaMailForwardingAddress);
+ $smarty->assign("mail",$this->mail);
+ $display= $smarty->fetch (get_template_path('paste_mail.tpl', TRUE));
+ $ret = array();
+ $ret['string'] = $display;
+ $ret['status'] = "";
+ return($ret);
+ }
+
+ function saveCopyDialog()
+ {
+ if(!$this->is_account) return;
+
+ /* Perform ADD / REMOVE ... for mail alternate / mail forwarding addresses
+ */
+ $this->execute();
+ if(isset($_POST['mail'])){
+ $this->mail = $_POST['mail'];
+ }
+ }
+
+
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: