From 4e594ac303eb05f0e7374d4c3df69dfd0ccca8be Mon Sep 17 00:00:00 2001 From: Artem Vasilev Date: Tue, 12 Mar 2024 01:20:08 +0300 Subject: [PATCH] getItems method overwrites in the ClientsModel --- .../administrator/src/Model/ClientsModel.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/com_oauthserver/administrator/src/Model/ClientsModel.php b/com_oauthserver/administrator/src/Model/ClientsModel.php index a3c34f2..8ccd7d3 100644 --- a/com_oauthserver/administrator/src/Model/ClientsModel.php +++ b/com_oauthserver/administrator/src/Model/ClientsModel.php @@ -84,6 +84,44 @@ class ClientsModel extends ListModel return parent::getStoreId($id); } + /** + * @inheritDoc + * @since version + */ + public function getItems() + { + $result = parent::getItems(); + + if (!$result) + { + return $result; + } + + // Get a storage key. + $store = $this->getStoreId(); + + /** @var \stdClass $row */ + foreach ($result as &$row) + { + // Convert `public` field to bool + $row->public = !empty($row->public); + + if (!empty($row->scopes)) + { + $row->scopes = json_decode($row->scopes, true); + } + + if (!empty($row->grants)) + { + $row->grants = json_decode($row->grants, true); + } + } + + $this->cache[$store] = $result; + + return $this->cache[$store]; + } + /** * Method to get a DatabaseQuery object for retrieving the data set from a database. *