From f25f6cde39bf415585e15c78c3eec9e7c7ee9cac Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 28 Apr 2014 14:13:09 +0200 Subject: Fix identities_level=4 handling in new_user_dialog plugin (#1489840) --- plugins/new_user_dialog/composer.json | 2 +- plugins/new_user_dialog/new_user_dialog.php | 21 +++++++++++++++------ plugins/new_user_dialog/package.xml | 4 ++-- 3 files changed, 18 insertions(+), 9 deletions(-) (limited to 'plugins') diff --git a/plugins/new_user_dialog/composer.json b/plugins/new_user_dialog/composer.json index 9dcedc36a..cf3a37291 100644 --- a/plugins/new_user_dialog/composer.json +++ b/plugins/new_user_dialog/composer.json @@ -3,7 +3,7 @@ "type": "roundcube-plugin", "description": "When a new user is created, this plugin checks the default identity and sets a session flag in case it is incomplete. An overlay box will appear on the screen until the user has reviewed/completed his identity.", "license": "GNU GPLv3+", - "version": "2.0", + "version": "2.1", "authors": [ { "name": "Thomas Bruederli", diff --git a/plugins/new_user_dialog/new_user_dialog.php b/plugins/new_user_dialog/new_user_dialog.php index 39a707638..4203f93bc 100644 --- a/plugins/new_user_dialog/new_user_dialog.php +++ b/plugins/new_user_dialog/new_user_dialog.php @@ -59,7 +59,8 @@ class new_user_dialog extends rcube_plugin $table->add(null, html::tag('input', array( 'type' => 'text', 'name' => '_name', - 'value' => $identity['name'] + 'value' => $identity['name'], + 'disabled' => $identities_level == 4 ))); $table->add('title', $this->gettext('email')); @@ -67,14 +68,15 @@ class new_user_dialog extends rcube_plugin 'type' => 'text', 'name' => '_email', 'value' => rcube_utils::idn_to_utf8($identity['email']), - 'disabled' => ($identities_level == 1 || $identities_level == 3) + 'disabled' => in_array($identities_level, array(1, 3, 4)) ))); $table->add('title', $this->gettext('organization')); $table->add(null, html::tag('input', array( 'type' => 'text', 'name' => '_organization', - 'value' => $identity['organization'] + 'value' => $identity['organization'], + 'disabled' => $identities_level == 4 ))); $table->add('title', $this->gettext('signature')); @@ -130,6 +132,7 @@ class new_user_dialog extends rcube_plugin $rcmail = rcmail::get_instance(); $identity = $rcmail->user->get_identity(); $ident_level = intval($rcmail->config->get('identities_level', 0)); + $disabled = array(); $save_data = array( 'name' => rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST), @@ -138,9 +141,15 @@ class new_user_dialog extends rcube_plugin 'signature' => rcube_utils::get_input_value('_signature', rcube_utils::INPUT_POST), ); - // don't let the user alter the e-mail address if disabled by config - if (in_array($ident_level, array(1,3,4))) { - $save_data['email'] = $identity['email']; + if ($ident_level == 4) { + $disabled = array('name', 'email', 'organization'); + } + else if (in_array($ident_level, array(1, 3))) { + $disabled = array('email'); + } + + foreach ($disabled as $key) { + $save_data[$key] = $identity[$key]; } if (empty($save_data['name']) || empty($save_data['email'])) { diff --git a/plugins/new_user_dialog/package.xml b/plugins/new_user_dialog/package.xml index 68a929931..90ca4bed0 100644 --- a/plugins/new_user_dialog/package.xml +++ b/plugins/new_user_dialog/package.xml @@ -13,9 +13,9 @@ roundcube@gmail.com yes - 2013-05-09 + 2014-04-28 - 2.0 + 2.1 2.0 -- cgit v1.2.3