From a2957fe69af0dff3bc6d3a9676c59903c9388763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be> Date: Wed, 21 Sep 2016 12:17:11 +0200 Subject: [PATCH] Fixes #5154 Cleaned up calls to lock system --- include/class_management.inc | 9 ++++----- include/simpleplugin/class_simpleManagement.inc | 13 ++++++------- include/simpleplugin/class_simplePlugin.inc | 4 ++-- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/include/class_management.inc b/include/class_management.inc index 5f9435469..2c68b4825 100644 --- a/include/class_management.inc +++ b/include/class_management.inc @@ -338,8 +338,8 @@ class management if (count($this->dns)) { // check locks - if ($user = get_locks($this->dns)) { - return gen_locked_message($user, $this->dns); + if ($locks = get_locks($this->dns)) { + return gen_locked_message($locks, $this->dns); } // Add locks @@ -741,9 +741,8 @@ class management // Get the dn of the object and creates lock $this->dn = array_pop($target); set_object_info($this->dn); - $user = get_lock($this->dn); - if ($user != "") { - return gen_locked_message($user, $this->dn, TRUE); + if ($locks = get_locks($this->dn)) { + return gen_locked_message($locks, $this->dn, TRUE); } add_lock ($this->dn, $ui->dn); diff --git a/include/simpleplugin/class_simpleManagement.inc b/include/simpleplugin/class_simpleManagement.inc index 05ed7a785..e35e00221 100644 --- a/include/simpleplugin/class_simpleManagement.inc +++ b/include/simpleplugin/class_simpleManagement.inc @@ -479,8 +479,8 @@ class simpleManagement extends management $this->dns = $target; // check locks - if ($user = get_locks($this->dns)) { - return gen_locked_message($user, $this->dns); + if ($locks = get_locks($this->dns)) { + return gen_locked_message($locks, $this->dns); } // Add locks @@ -590,9 +590,8 @@ class simpleManagement extends management // Get the dn of the object and creates lock $this->dn = array_pop($target); set_object_info($this->dn); - $user = get_lock($this->dn); - if ($user != "") { - return gen_locked_message($user, $this->dn, TRUE); + if ($locks = get_locks($this->dn)) { + return gen_locked_message($locks, $this->dn, TRUE); } add_lock ($this->dn, $ui->dn); @@ -658,8 +657,8 @@ class simpleManagement extends management if (count($this->dns)) { // check locks - if ($user = get_locks($this->dns)) { - return gen_locked_message($user, $this->dns); + if ($locks = get_locks($this->dns)) { + return gen_locked_message($locks, $this->dns); } // Add locks diff --git a/include/simpleplugin/class_simplePlugin.inc b/include/simpleplugin/class_simplePlugin.inc index ee804fc1c..888b865ec 100644 --- a/include/simpleplugin/class_simplePlugin.inc +++ b/include/simpleplugin/class_simplePlugin.inc @@ -880,10 +880,10 @@ class simplePlugin extends plugin /* Enter edit mode? */ if ((isset($_POST['edit'])) && (!session::is_set('edit'))) { /* Check locking */ - if (($username = get_lock($entry_dn)) != "") { + if ($locks = get_locks($entry_dn)) { session::set('back_plugin', $plug); session::set('LOCK_VARS_TO_USE', array("/^edit$/", "/^plug$/")); - $lock_msg = gen_locked_message($username, $entry_dn); + $lock_msg = gen_locked_message($locks, $entry_dn); } else { /* Lock the current entry */ add_lock($entry_dn, $ui->dn); -- GitLab