From 85b4122ba310f67d6e3fdb671fb3a128ce8a678f Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 15 Nov 2006 05:45:45 +0000 Subject: [PATCH] Updated mail acls git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5115 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/personal/mail/class_mailAccount.inc | 92 +++++++++++++++------ plugins/personal/mail/generic.tpl | 3 +- 2 files changed, 67 insertions(+), 28 deletions(-) diff --git a/plugins/personal/mail/class_mailAccount.inc b/plugins/personal/mail/class_mailAccount.inc index a05356e81..14ebe5457 100644 --- a/plugins/personal/mail/class_mailAccount.inc +++ b/plugins/personal/mail/class_mailAccount.inc @@ -502,12 +502,25 @@ class mailAccount extends plugin /* Display mail account tab */ $smarty->assign("mailServers", $mailserver); - foreach(array("gosaMailServer", "gosaMailQuota", "perms", "mail", - "gosaMailAlternateAddress", "gosaMailForwardingAddress", - "gosaVacationMessage", "gosaMailDeliveryMode", - "gosaMailMaxSize", "gosaSpamSortLevel", "gosaSpamMailbox") as $val){ - - $smarty->assign("$val", $this->$val); + foreach(array( + "gosaMailServer", + "gosaMailQuota", + "perms", + "mail", + "gosaMailAlternateAddress", + "gosaMailForwardingAddress", + + // gosaMailDeliveryMode Flags + "drop_own_mails", // No local delivery + "gosaMailMaxSize", // Enable - Drop mails > max size + "gosaSpamSortLevel", "gosaSpamMailbox", // Enable - Spam sort options + "gosaVacationMessage", // Enable - Vacation message + "custom_sieve", // Use custom sieve script + "only_local" // Send/receive local mails + ) as $val){ + if(isset($this->$val)){ + $smarty->assign("$val", $this->$val); + } $smarty->assign("$val"."ACL", chkacl($this->acl, "$val")); } @@ -683,32 +696,57 @@ class mailAccount extends plugin I: Only insider delivery */ $tmp= ""; - if (!isset($_POST["drop_own_mails"])){ - $tmp.= "L"; - } - if (isset($_POST["use_mailsize_limit"])){ - $tmp.= "R"; - } - if (isset($_POST["use_spam_filter"])){ - $tmp.= "S"; - } - if (isset($_POST["use_vacation"])){ - $tmp.= "V"; - } - if (isset($_POST["own_script"])){ - $tmp.= "C"; + $Flags = array( + "R" => array("ACL" => "gosaMailMaxSize", "POST" => "use_mailsize_limit"), + "V" => array("ACL" => "gosaVacationMessage","POST" => "use_vacation"), + "C" => array("ACL" => "custom_sieve", "POST" => "own_script"), + "I" => array("ACL" => "only_local", "POST" => "only_local")); + + /* Check acls and set new value if allowed. + If we do not have permission to change the value + check for the old value and use this */ + foreach($Flags as $flag => $val){ + $acl = $val['ACL']; + $post = $val['POST']; + if(chkacl($this->acl,$acl) ==""){ + if (isset($_POST[$post])){ + $tmp.= $flag; + } + }else{ + if(preg_match("/".$flag."/",$this->gosaMailDeliveryMode)){ + $tmp.= $flag ; + } + } } - if (isset($_POST["only_local"])){ - $tmp.= "I"; + + /* ! Inverse flag handling for drop_own_mails */ + if(chkacl($this->acl,"drop_own_mails") == ""){ + if (!isset($_POST['drop_own_mails'])){ + $tmp.= "L"; + } + }else{ + if(preg_match("/L/",$this->gosaMailDeliveryMode)){ + $tmp.= "L" ; + } } - $tmp= "[$tmp]"; - if (chkacl ($this->acl, "gosaMailDeliveryMode") == ""){ - if ($this->gosaMailDeliveryMode != $tmp){ - $this->is_modified= TRUE; + /* If one of these acls are given, we are allowed to enable disable the the spam settings */ + if(chkacl($this->acl,"gosaSpamMailbox") == "" || chkacl($this->acl,"gosaSpamSortLevel") ==""){ + if (isset($_POST["use_spam_filter"])){ + $tmp.= "S"; } - $this->gosaMailDeliveryMode= $tmp; + }else{ + if(preg_match("/S/",$this->gosaMailDeliveryMode)){ + $tmp.= "S" ; + } + } + + /* Check if something has changed an assign new gosaMailDeliveryMode */ + $tmp= "[$tmp]"; + if ($this->gosaMailDeliveryMode != $tmp){ + $this->is_modified= TRUE; } + $this->gosaMailDeliveryMode= $tmp; } } diff --git a/plugins/personal/mail/generic.tpl b/plugins/personal/mail/generic.tpl index 56bd1e9a5..5e291216b 100644 --- a/plugins/personal/mail/generic.tpl +++ b/plugins/personal/mail/generic.tpl @@ -1,3 +1,4 @@ +
@@ -69,7 +70,7 @@
{t}No delivery to own mailbox{/t} + {$drop_own_mailsACL} title="{t}Select if you want to forward mails without getting own copies of them{/t}"> {t}No delivery to own mailbox{/t}
{t}Activate vacation message{/t} -- 2.30.2