summaryrefslogtreecommitdiffstats
path: root/lib/kolab_client_task.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-09-24 13:22:31 +0200
committerAleksander Machniak <alec@alec.pl>2013-09-24 13:22:31 +0200
commit48e4427ff85ac7606c3045b1b906dc87c6c8cf20 (patch)
treec77e0914451195b01c090f973a575b22e7b6bd07 /lib/kolab_client_task.php
parent55b0e6f4f7b5cb743d73d5e389d05ae0bda2428a (diff)
downloadwebadmin-48e4427ff85ac7606c3045b1b906dc87c6c8cf20.tar.gz
Prevent from deleting oneself (Bug #1808)
Diffstat (limited to 'lib/kolab_client_task.php')
-rw-r--r--lib/kolab_client_task.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 6e3eaa0..f6e574c 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -225,6 +225,10 @@ class kolab_client_task
if (is_array($res) && !empty($res)) {
$user['language'] = $res['preferredlanguage'];
$user['fullname'] = $res['cn'];
+
+ // overwrite user id set in login request, which is user base DN,
+ // with unique attribute, which suits better to our needs
+ $user['id'] = $res['id'];
}
}
@@ -1333,10 +1337,14 @@ class kolab_client_task
if (!empty($data['id']) && in_array('delete', (array) $data['effective_rights']['entry'])) {
$id = $data['id'];
- $form->add_button(array(
- 'value' => kolab_html::escape($this->translate('button.delete')),
- 'onclick' => "kadm.{$name}_delete('{$id}')",
- ));
+
+ // disable delete for self
+ if ($id != $_SESSION['user']['id']) {
+ $form->add_button(array(
+ 'value' => kolab_html::escape($this->translate('button.delete')),
+ 'onclick' => "kadm.{$name}_delete('{$id}')",
+ ));
+ }
}
$ac_min_len = $this->config_get('autocomplete_min_length', 1, Conf::INT);