diff options
author | Aleksander Machniak <alec@alec.pl> | 2014-04-28 14:13:09 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2014-04-28 14:22:07 +0200 |
commit | f25f6cde39bf415585e15c78c3eec9e7c7ee9cac (patch) | |
tree | dc99c0daef8ba83264035a9d5d3ca95c19433226 /plugins | |
parent | cbd5388d2e989b719fdfff2e5d13eb6225c3e675 (diff) |
Fix identities_level=4 handling in new_user_dialog plugin (#1489840)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/new_user_dialog/composer.json | 2 | ||||
-rw-r--r-- | plugins/new_user_dialog/new_user_dialog.php | 21 | ||||
-rw-r--r-- | plugins/new_user_dialog/package.xml | 4 |
3 files changed, 18 insertions, 9 deletions
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 @@ <email>roundcube@gmail.com</email> <active>yes</active> </lead> - <date>2013-05-09</date> + <date>2014-04-28</date> <version> - <release>2.0</release> + <release>2.1</release> <api>2.0</api> </version> <stability> |