Fix not selecting right ACL common options when the with different sorted rights. Now common rights abbrivation are sorted alphabetically

This commit is contained in:
Hadi Nategh 2014-02-28 15:39:46 +00:00
parent 796e48cd3d
commit ecc37850f0
2 changed files with 6 additions and 5 deletions

View File

@ -31,8 +31,8 @@ class mail_acl
'lrs' => array('label'=>'readable','title'=>'Allows a user to read the contents of the mailbox.'), '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.'), '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.'), '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.'),
'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.'), 'ilprsw' => 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.'), 'aeiklprstwx'=> 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'), 'custom' => array('label'=>'custom','title'=>'User defined combination of rights for the ACL'),
); );
@ -93,6 +93,7 @@ class mail_acl
$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_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 $content['grid'][$n]['acl_d'] = array_diff($virtualD,array_intersect($rights,$virtuals['d']))? false: true; //d=et more information rfc4314, Obsolote Rights
sort($rights);
$acl_abbrvs = implode('',$rights); $acl_abbrvs = implode('',$rights);
if (array_key_exists($acl_abbrvs, $this->aclRightsAbbrvs)) if (array_key_exists($acl_abbrvs, $this->aclRightsAbbrvs))

View File

@ -50,7 +50,7 @@ app.classes.mail = AppJS.extend(
* @array * @array
* *
*/ */
aclCommonRights:['lrs','lprs','ilprs', 'ilprws', 'akxeilprwts', 'custom'], aclCommonRights:['lrs','lprs','ilprs', 'ilprsw', 'aeiklprstwx', 'custom'],
/** /**
* Demonstrates ACL rights * Demonstrates ACL rights
* @array * @array
@ -2575,7 +2575,7 @@ app.classes.mail = AppJS.extend(
acl_common_rights_selector: function(event,widget) acl_common_rights_selector: function(event,widget)
{ {
var rowId = widget.id.replace(/[^0-9.]+/g, ''); var rowId = widget.id.replace(/[^0-9.]+/g, '');
var rights = (widget.get_value() == "custom")?[]:(widget.get_value() == "akxeilprwts")? widget.get_value().replace(/[k,x,t,e]/g,"cd").split(""):widget.get_value().split(""); var rights = (widget.get_value() == "custom")?[]:(widget.get_value() == "aeiklprstwx")? widget.get_value().replace(/[k,x,t,e]/g,"cd").split(""):widget.get_value().split("");
for (var i=0;i<this.aclRights.length;i++) for (var i=0;i<this.aclRights.length;i++)
{ {
var rightsWidget = this.et2.getWidgetById(rowId+'[acl_' + this.aclRights[i]+ ']'); var rightsWidget = this.et2.getWidgetById(rowId+'[acl_' + this.aclRights[i]+ ']');
@ -2616,7 +2616,7 @@ app.classes.mail = AppJS.extend(
} }
else if (rights =='lrswipcda') else if (rights =='lrswipcda')
{ {
aclCommonWidget.set_value('akxeilprwts'); aclCommonWidget.set_value('aeiklprstwx');
} }
else else
{ {