From d660eb9a1ba1b3d75aff6e6df59bd36f0e6ba785 Mon Sep 17 00:00:00 2001 From: Allon Moritz Date: Wed, 21 Sep 2022 11:51:33 +0200 Subject: [PATCH] Do not checkout a record when the user is not logged in --- libraries/src/MVC/Model/FormModel.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/src/MVC/Model/FormModel.php b/libraries/src/MVC/Model/FormModel.php index e9a14c3ce47ee..736876888ffd1 100644 --- a/libraries/src/MVC/Model/FormModel.php +++ b/libraries/src/MVC/Model/FormModel.php @@ -129,6 +129,13 @@ public function checkin($pk = null) */ public function checkout($pk = null) { + $user = $this->getCurrentUser(); + + // When the user is a guest, don't do a checkout + if (!$user->id) { + return true; + } + // Only attempt to check the row in if it exists. if ($pk) { // Get an instance of the row to checkout. @@ -150,7 +157,6 @@ public function checkout($pk = null) return true; } - $user = $this->getCurrentUser(); $checkedOutField = $table->getColumnAlias('checked_out'); // Check if this is the user having previously checked out the row.