Fix bug where read-only folder was displayed as read-write in delegation form and it wasn't possible to unset ACL on a folder (#5347)

This commit is contained in:
Aleksander Machniak 2016-02-26 11:18:41 +01:00
parent 8ac3269ee5
commit b6c1f28c04
2 changed files with 9 additions and 11 deletions

View file

@ -188,8 +188,8 @@ rcube_webmail.prototype.delegate_save = function()
}
data.folders = {};
$('input.read:checked').each(function(i, elem) {
data.folders[elem.value] = 1;
$('input.read').each(function(i, elem) {
data.folders[elem.value] = this.checked ? 1 : 0;
});
$('input.write:checked').each(function(i, elem) {
data.folders[elem.value] = 2;

View file

@ -105,6 +105,9 @@ class kolab_delegation_engine
if ($r) {
$storage->set_acl($folder_name, $uid, $r);
}
else {
$storage->delete_acl($folder_name, $uid);
}
if (!empty($folders) && isset($folders[$folder_name])) {
unset($folders[$folder_name]);
@ -863,12 +866,10 @@ class kolab_delegation_engine
/**
* Compares two ACLs (according to supported rights)
*
* @todo: this is stolen from acl plugin, move to rcube_storage/rcube_imap
*
* @param array $acl1 ACL rights array (or string)
* @param array $acl2 ACL rights array (or string)
*
* @param int Comparision result, 2 - full match, 1 - partial match, 0 - no match
* @param bool True if $acl1 contains all rights from $acl2
*/
function acl_compare($acl1, $acl2)
{
@ -884,12 +885,9 @@ class kolab_delegation_engine
$cnt1 = count($res);
$cnt2 = count($acl2);
if ($cnt1 == $cnt2)
return 2;
else if ($cnt1)
return 1;
else
return 0;
if ($cnt1 >= $cnt2) {
return true;
}
}
/**