From 2c4595005b7d8763b9cd4842f059d6fd2683c947 Mon Sep 17 00:00:00 2001 From: Paolo Date: Thu, 23 Mar 2017 11:51:18 +0100 Subject: [PATCH] DB_Model->_isEntitled: now if the user is not entitled to perform an operation the query is reset --- application/core/DB_Model.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/application/core/DB_Model.php b/application/core/DB_Model.php index f34d6fe1c..a0bc1e8f7 100644 --- a/application/core/DB_Model.php +++ b/application/core/DB_Model.php @@ -651,9 +651,13 @@ class DB_Model extends FHC_Model substr(get_called_class(), -6) == DB_Model::MODEL_POSTFIX) || $permission != PermissionLib::SELECT_RIGHT) { + // If true is not returned, then an error has occurred if (($isEntitled = $this->isEntitled($this->dbTable, $permission, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) { - // TODO: resetQuery + // Before returning the object containing the error, reset the build query + // This is for preventing that other parts of the query will be built before of the next execution + $this->resetQuery(); + return $isEntitled; } }