From b06b18e006af2eeb82c86b2d19a2504b65a658f4 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Mon, 9 Dec 2013 10:10:51 +0000 Subject: [PATCH] Fix to set combination of Obsolote Rights (eg. c=kx) for ACL mail application --- mail/inc/class.mail_acl.inc.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/mail/inc/class.mail_acl.inc.php b/mail/inc/class.mail_acl.inc.php index 2f273b6056..f7faf0ac10 100644 --- a/mail/inc/class.mail_acl.inc.php +++ b/mail/inc/class.mail_acl.inc.php @@ -31,8 +31,8 @@ class mail_acl 'lrs' => array('label'=>'readable','title'=>'Allows a user to read the contents of the mailbox.'), 'lprs' => array('label'=>'post','title'=>'Allows a user to read the mailbox and post to it through the delivery system by sending mail to the submission address of the mailbox.'), 'ilprs' => array('label'=>'append','title'=>'Allows a user to read the mailbox and append messages to it, either via IMAP or through the delivery system.'), - 'cdilprsw' => array('label'=>'write','title'=>'Allows a user to read the maibox, post to it, append messages to it, and delete messages or the mailbox itself. The only right not given is the right to change the ACL of the mailbox.'), - 'acdilprsw' => array('label'=>'all','title'=>'The user has all possible rights on the mailbox. This is usually granted to users only on the mailboxes they own.'), + 'ilprws' => array('label'=>'write','title'=>'Allows a user to read the maibox, post to it, append messages to it, and delete messages or the mailbox itself. The only right not given is the right to change the ACL of the mailbox.'), + 'akxeilprwts'=> array('label'=>'all','title'=>'The user has all possible rights on the mailbox. This is usually granted to users only on the mailboxes they own.'), 'custom' => array('label'=>'custom','title'=>'User defined combination of rights for the ACL'), ); @@ -81,13 +81,18 @@ class mail_acl $n = 1; foreach ($acl as $keys => $value) { + $virtuals = array_pop(array_values((array)$value)); + $rights = array_shift(array_values((array)$value)); - $value = array_shift(array_values((array)$value)); - foreach ($value as $right) + foreach ($rights as $right) { $content['grid'][$n]['acl_'. $right] = true; } - $acl_abbrvs = implode('',$value); + $virtualD = array('e','t'); + $content['grid'][$n]['acl_c'] = array_diff($virtuals['c'],array_intersect($rights,$virtuals['c']))? false: true; //c=kx more information rfc4314, Obsolote Rights + $content['grid'][$n]['acl_d'] = array_diff($virtualD,array_intersect($rights,$virtuals['d']))? false: true; //d=et more information rfc4314, Obsolote Rights + + $acl_abbrvs = implode('',$rights); if (array_key_exists($acl_abbrvs, $this->aclRightsAbbrvs)) { @@ -161,7 +166,7 @@ class mail_acl } } $sel_options['acl'] = $this->aclRightsAbbrvs; - + $readonlys['grid']['delete[1]'] = true; $preserv ['mailbox'] = $content['mailbox']; $content['msg'] = $msg; $tmpl->exec('mail.mail_acl.edit', $content, $sel_options, $readonlys, $preserv,2); @@ -194,6 +199,8 @@ class mail_acl if ($value[$key] == true) { $right = explode("acl_" ,$key); + if ($right[1] === 'c') $right[1] = 'kx'; // c = kx , rfc 4314 + if ($right[1] === 'd') $right[1] = 'et'; // d = et , rfc 4314 $options['rights'] .= $right[1]; } }