2 commits - plugins/kolab_folders plugins/tasklist
Thomas Brüderli
bruederli at kolabsys.com
Thu Mar 12 14:56:26 CET 2015
plugins/kolab_folders/kolab_folders.php | 66 ++++++++++++++++++++++++++++++++
plugins/tasklist/tasklist.js | 2
2 files changed, 67 insertions(+), 1 deletion(-)
New commits:
commit e187d0880be4d444064eda83cde10c87de9dbbe5
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Thu Mar 12 14:55:04 2015 +0100
Subscribe to ACL plugin hooks and adjust the permission items for groupware folders (#4839)
diff --git a/plugins/kolab_folders/kolab_folders.php b/plugins/kolab_folders/kolab_folders.php
index b3c2e8e..6a01b24 100644
--- a/plugins/kolab_folders/kolab_folders.php
+++ b/plugins/kolab_folders/kolab_folders.php
@@ -68,6 +68,10 @@ class kolab_folders extends rcube_plugin
// Special folders setting
$this->add_hook('preferences_save', array($this, 'prefs_save'));
+
+ // ACL plugin hooks
+ $this->add_hook('acl_rights_simple', array($this, 'acl_rights_simple'));
+ $this->add_hook('acl_rights_supported', array($this, 'acl_rights_supported'));
}
/**
@@ -443,6 +447,68 @@ class kolab_folders extends rcube_plugin
}
/**
+ * Handler for ACL permissions listing (acl_rights_simple hook)
+ *
+ * This shall combine the write and delete permissions into one item for
+ * groupware folders as updating groupware objects is an insert + delete operation.
+ *
+ * @param array $args Hash array with hook parameters
+ *
+ * @return array Hash array with modified hook parameters
+ */
+ public function acl_rights_simple($args)
+ {
+ if ($args['folder']) {
+ list($type,) = $this->get_folder_type($args['folder']);
+
+ // we're dealing with a groupware folder here...
+ if ($type && $type !== 'mail') {
+ if ($args['rights']['write'] && $args['rights']['delete']) {
+ $writeperms = $args['rights']['write'] . $args['rights']['delete'];
+ $items = array(
+ 'read' => 'lr',
+ 'write' => $writeperms,
+ 'other' => preg_replace('/[lr'.$writeperms.']/', '', $args['rights']['other']),
+ );
+ $args['rights'] = $items;
+
+ // add localized labels and titles for the altered items
+ $args['labels'] = array(
+ 'other' => $this->rc->gettext('shortacla','acl'),
+ );
+ $args['titles'] = array(
+ 'other' => $this->rc->gettext('longaclother','acl'),
+ );
+ }
+ }
+ }
+
+ return $args;
+ }
+
+ /**
+ * Handler for ACL permissions listing (acl_rights_supported hook)
+ *
+ * @param array $args Hash array with hook parameters
+ *
+ * @return array Hash array with modified hook parameters
+ */
+ public function acl_rights_supported($args)
+ {
+ if ($args['folder']) {
+ list($type,) = $this->get_folder_type($args['folder']);
+
+ // we're dealing with a groupware folder here...
+ if ($type && $type !== 'mail') {
+ // remove some irrelevant (for groupware objects) rights
+ $args['rights'] = str_split(preg_replace('/[sp]/', '', join('', $args['rights'])));
+ }
+ }
+
+ return $args;
+ }
+
+ /**
* Checks if IMAP server supports any of METADATA, ANNOTATEMORE, ANNOTATEMORE2
*
* @return boolean
commit a5436ece25949c7c542ed7ce05d80b3de4e8224e
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Thu Mar 12 14:53:41 2015 +0100
Better permission check in tasklist edit form
diff --git a/plugins/tasklist/tasklist.js b/plugins/tasklist/tasklist.js
index 2de279a..9f18746 100644
--- a/plugins/tasklist/tasklist.js
+++ b/plugins/tasklist/tasklist.js
@@ -2707,7 +2707,7 @@ function rcube_tasklist_ui(settings)
editform = $('#tasklisteditform');
me.dialog_resize(rcmail.gui_containers.tasklistform, editform.height(), editform.width());
- name = $('#taskedit-tasklistame').prop('disabled', list.norename||false).val(list.editname || list.name);
+ name = $('#taskedit-tasklistame').prop('disabled', !has_permission(list, 'a')||list.norename).val(list.editname || list.name);
alarms = $('#taskedit-showalarms').prop('checked', list.showalarms).get(0);
name.select();
More information about the commits
mailing list