diff options
Diffstat (limited to 'plugins/acl/acl.php')
-rw-r--r-- | plugins/acl/acl.php | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/plugins/acl/acl.php b/plugins/acl/acl.php index ffaa51b6d..59406262e 100644 --- a/plugins/acl/acl.php +++ b/plugins/acl/acl.php @@ -234,7 +234,8 @@ class acl extends rcube_plugin // 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)) @@ -384,7 +385,6 @@ class acl extends rcube_plugin $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 +433,9 @@ class acl extends rcube_plugin $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 +443,7 @@ class acl extends rcube_plugin 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)); } @@ -453,6 +454,9 @@ class acl extends rcube_plugin 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)) { $ret = array('id' => rcube_utils::html_identifier($user), @@ -704,4 +708,23 @@ class acl extends rcube_plugin 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; + } } |