summaryrefslogtreecommitdiff
path: root/plugins/new_user_dialog/new_user_dialog.php
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:22:07 +0200
commitf25f6cde39bf415585e15c78c3eec9e7c7ee9cac (patch)
treedc99c0daef8ba83264035a9d5d3ca95c19433226 /plugins/new_user_dialog/new_user_dialog.php
parentcbd5388d2e989b719fdfff2e5d13eb6225c3e675 (diff)
Fix identities_level=4 handling in new_user_dialog plugin (#1489840)
Diffstat (limited to 'plugins/new_user_dialog/new_user_dialog.php')
-rw-r--r--plugins/new_user_dialog/new_user_dialog.php21
1 files changed, 15 insertions, 6 deletions
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'])) {