From 3412e50b54e3daac8745234e21ab6e72be0ed165 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Wed, 04 Jun 2014 11:20:33 -0400
Subject: [PATCH] Fix attachment menu structure and aria-attributes
---
plugins/acl/acl.php | 54 +++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 39 insertions(+), 15 deletions(-)
diff --git a/plugins/acl/acl.php b/plugins/acl/acl.php
index ffaa51b..d7e50f9 100644
--- a/plugins/acl/acl.php
+++ b/plugins/acl/acl.php
@@ -9,18 +9,18 @@
*
* Copyright (C) 2011-2012, Kolab Systems AG
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://www.gnu.org/licenses/.
*/
class acl extends rcube_plugin
@@ -86,7 +86,7 @@
$this->load_config();
$search = rcube_utils::get_input_value('_search', rcube_utils::INPUT_GPC, true);
- $sid = rcube_utils::get_input_value('_id', rcube_utils::INPUT_GPC);
+ $reqid = rcube_utils::get_input_value('_reqid', rcube_utils::INPUT_GPC);
$users = array();
if ($this->init_ldap()) {
@@ -115,7 +115,7 @@
sort($users, SORT_LOCALE_STRING);
- $this->rc->output->command('ksearch_query_results', $users, $search, $sid);
+ $this->rc->output->command('ksearch_query_results', $users, $search, $reqid);
$this->rc->output->send();
}
@@ -150,7 +150,8 @@
$this->load_config();
$this->specials = $this->rc->config->get('acl_specials', $this->specials);
$this->add_texts('localization/', array('deleteconfirm', 'norights',
- 'nouser', 'deleting', 'saving'));
+ 'nouser', 'deleting', 'saving', 'newuser', 'editperms'));
+ $this->rc->output->add_label('save', 'cancel');
$this->include_script('acl.js');
$this->rc->output->include_script('list.js');
$this->include_stylesheet($this->local_skin_path().'/acl.css');
@@ -234,7 +235,8 @@
// Advanced rights
$attrib['id'] = 'advancedrights';
- foreach ($supported as $idx => $val) {
+ foreach ($supported as $key => $val) {
+ $id = "acl$val";
$ul .= html::tag('li', null,
$input->show('', array(
'name' => "acl[$val]", 'value' => $val, 'id' => $id))
@@ -306,7 +308,7 @@
. $val);
}
- $out = html::tag('ul', array('id' => 'usertype'), $ul, html::$common_attrib);
+ $out = html::tag('ul', array('id' => 'usertype', 'class' => $attrib['class']), $ul, html::$common_attrib);
}
// Display text input alone
else {
@@ -384,7 +386,6 @@
$table->add_header(array('class' => 'acl'.$key, 'title' => $label), $label);
}
- $i = 1;
$js_table = array();
foreach ($acl as $user => $rights) {
if ($this->rc->storage->conn->user == $user) {
@@ -433,8 +434,9 @@
$acl = trim(rcube_utils::get_input_value('_acl', rcube_utils::INPUT_GPC));
$oldid = trim(rcube_utils::get_input_value('_old', rcube_utils::INPUT_GPC));
- $acl = array_intersect(str_split($acl), $this->rights_supported());
- $users = $oldid ? array($user) : explode(',', $user);
+ $acl = array_intersect(str_split($acl), $this->rights_supported());
+ $users = $oldid ? array($user) : explode(',', $user);
+ $result = 0;
foreach ($users as $user) {
$user = trim($user);
@@ -442,7 +444,7 @@
if (!empty($this->specials) && in_array($user, $this->specials)) {
$username = $this->gettext($user);
}
- else {
+ else if (!empty($user)) {
if (!strpos($user, '@') && ($realm = $this->get_realm())) {
$user .= '@' . rcube_utils::idn_to_ascii(preg_replace('/^@/', '', $realm));
}
@@ -452,6 +454,9 @@
if (!$acl || !$user || !strlen($mbox)) {
continue;
}
+
+ $user = $this->mod_login($user);
+ $username = $this->mod_login($username);
if ($user != $_SESSION['username'] && $username != $_SESSION['username']) {
if ($this->rc->storage->set_acl($mbox, $user, $acl)) {
@@ -704,4 +709,23 @@
return $this->ldap->ready;
}
+
+ /**
+ * Modify user login according to 'login_lc' setting
+ */
+ protected function mod_login($user)
+ {
+ $login_lc = $this->rc->config->get('login_lc');
+
+ if ($login_lc === true || $login_lc == 2) {
+ $user = mb_strtolower($user);
+ }
+ // lowercase domain name
+ else if ($login_lc && strpos($user, '@')) {
+ list($local, $domain) = explode('@', $user);
+ $user = $local . '@' . mb_strtolower($domain);
+ }
+
+ return $user;
+ }
}
--
Gitblit v1.9.1