summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-12-16 12:40:30 (GMT)
committerAleksander Machniak <alec@alec.pl>2013-12-16 12:52:39 (GMT)
commit0e4c76872236be7db4599aeabef27fe6352a90f7 (patch)
treef72e572605107cff5fec243f916a80f7ad5e6408
parent0dd7805c9a3136e134e701138a7a1b089849b755 (diff)
downloadkolab-wap-0e4c76872236be7db4599aeabef27fe6352a90f7.tar.gz
Skip regenerate request for auto-fields that are readonly (by ACL)
-rw-r--r--lib/kolab_client_task.php15
-rw-r--r--public_html/js/kolab_admin.js3
2 files changed, 14 insertions, 4 deletions
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index c845126..20c4bc0 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -1063,6 +1063,7 @@ class kolab_client_task
$admin_auto_fields_rw = $this->config_get('admin_auto_fields_rw', false, Conf::BOOL);
foreach ($fields as $idx => $field) {
+ $readonly = null;
if (!array_key_exists($idx, $attribute_rights)) {
// If the entry level rights contain 'add' and 'delete', well, you're an admin
if (in_array('add', $entry_rights) && in_array('delete', $entry_rights)) {
@@ -1071,7 +1072,7 @@ class kolab_client_task
}
}
else {
- $fields[$idx]['readonly'] = true;
+ $fields[$idx]['readonly'] = $readonly = true;
}
}
else {
@@ -1081,10 +1082,18 @@ class kolab_client_task
}
}
// Explicit attribute level rights, check for 'write'
- elseif (!in_array('write', $attribute_rights[$idx])) {
- $fields[$idx]['readonly'] = true;
+ else if (!in_array('write', $attribute_rights[$idx])) {
+ $fields[$idx]['readonly'] = $readonly = true;
}
}
+
+ // disable auto-fields updates, user has no rights to modify them anyway
+ if (is_bool($readonly) && $readonly) {
+ if (($s_idx = array_search($idx, $auto_attribs)) !== false) {
+ unset($auto_attribs[$s_idx]);
+ }
+ unset($auto_fields[$idx]);
+ }
}
// Register list of auto-generated fields
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index 4df6339..659645c 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -1328,7 +1328,8 @@ function kolab_admin()
}
}
- this.api_post('form_value.generate', data, 'form_value_response');
+ if (data.attributes.length)
+ this.api_post('form_value.generate', data, 'form_value_response');
this.set_busy(false);
};