summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-04-28 14:13:09 +0200
committerAleksander Machniak <alec@alec.pl>2014-04-28 14:13:09 +0200
commit2581c87e657041b478d2b9f1ea78de00a4499013 (patch)
tree1eeb313e87e8feedea64cac7d828def5632b6aef /plugins
parent64f40ef43cb4db9fe932a173d9154b4c82e1245e (diff)
Fix identities_level=4 handling in new_user_dialog plugin (#1489840)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/new_user_dialog/composer.json2
-rw-r--r--plugins/new_user_dialog/new_user_dialog.php21
-rw-r--r--plugins/new_user_dialog/package.xml4
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>