From ce736f5989b87e43381c4b8d7146ac0fcaa10aa1 Mon Sep 17 00:00:00 2001 From: ankush_m Date: Wed, 21 Sep 2022 17:41:31 +0530 Subject: [PATCH 1/7] Joomla 4 --- code/admin/tables/key.php | 5 +++-- code/admin/tables/log.php | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/code/admin/tables/key.php b/code/admin/tables/key.php index eaae23f..b4962bf 100644 --- a/code/admin/tables/key.php +++ b/code/admin/tables/key.php @@ -14,6 +14,7 @@ use Joomla\CMS\Factory; use Joomla\Registry\Registry; use Joomla\CMS\Language\Text; +use Joomla\CMS\Access\Access; /** * key Table class @@ -87,8 +88,8 @@ public function bind($array, $ignore = '') if (! Factory::getUser()->authorise('core.admin', 'com_api.key.' . $array['id'])) { - $actions = Factory::getACL()->getActions('com_api', 'key'); - $defaultActions = Factory::getACL()->getAssetRules('com_api.key.' . $array['id'])->getData(); + $actions = Access::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/com_api/access.xml', "/access/section[@name='key']/"); + $defaultActions = Access::getAssetRules('com_api.key.' . $array['id'])->getData(); $arrayJaccess = array(); foreach ($actions as $action) diff --git a/code/admin/tables/log.php b/code/admin/tables/log.php index 132234a..765abb9 100644 --- a/code/admin/tables/log.php +++ b/code/admin/tables/log.php @@ -13,6 +13,7 @@ use Joomla\Data\DataObject; use Joomla\CMS\Factory; use Joomla\Registry\Registry; +use Joomla\CMS\Access\Access; /** * Log Table class @@ -72,8 +73,8 @@ public function bind($array, $ignore = '') if (! Factory::getUser()->authorise('core.admin', 'com_api.key.' . $array['id'])) { - $actions = Factory::getACL()->getActions('com_api', 'key'); - $defaultActions = Factory::getACL()->getAssetRules('com_api.key.' . $array['id'])->getData(); + $actions = Access::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/com_api/access.xml', "/access/section[@name='key']/"); + $defaultActions = Access::getAssetRules('com_api.key.' . $array['id'])->getData(); $arrayJaccess = array(); foreach ($actions as $action) From 4866ae944dd64bcf7be248cc9d524f1de33bfd79 Mon Sep 17 00:00:00 2001 From: ankush_m Date: Thu, 22 Sep 2022 15:12:23 +0530 Subject: [PATCH 2/7] Joomla 4 --- code/site/libraries/plugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/site/libraries/plugin.php b/code/site/libraries/plugin.php index 9af3bb9..71248f5 100755 --- a/code/site/libraries/plugin.php +++ b/code/site/libraries/plugin.php @@ -497,7 +497,7 @@ final private function lastUsed() public function setResponse($data) { // For backward compatability -- TODO - if (!isset($data->result)) + if (!isset($data->result) && !empty($data)) { $data->result = clone $data; } From be17ff07a9d0b0078472a9909c6f600c470ded81 Mon Sep 17 00:00:00 2001 From: ankush_m Date: Thu, 22 Sep 2022 16:31:39 +0530 Subject: [PATCH 3/7] Joomla 4 --- code/admin/sql/install.mysql.utf8.sql | 34 +++++++++++++-------------- code/site/libraries/plugin.php | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/code/admin/sql/install.mysql.utf8.sql b/code/admin/sql/install.mysql.utf8.sql index a0f1889..becbc3d 100644 --- a/code/admin/sql/install.mysql.utf8.sql +++ b/code/admin/sql/install.mysql.utf8.sql @@ -1,26 +1,26 @@ CREATE TABLE IF NOT EXISTS `#__api_keys` ( -`id` int(11) NOT NULL AUTO_INCREMENT, - `userid` int(11) NOT NULL, - `hash` varchar(255) NOT NULL, - `domain` varchar(255) NOT NULL, - `state` tinyint(1) NOT NULL, - `checked_out` int(11) NOT NULL, - `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `created_by` int(11) NOT NULL, - `last_used` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `per_hour` int(10) NOT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + `userid` int(11) NOT NULL DEFAULT 0, + `hash` varchar(255) NOT NULL DEFAULT '', + `domain` varchar(255) NOT NULL DEFAULT '', + `state` tinyint(1) NOT NULL DEFAULT 0, + `checked_out` int(11) NOT NULL DEFAULT 0, + `checked_out_time` datetime DEFAULT NULL, + `created` datetime DEFAULT NULL, + `created_by` int(11) NOT NULL DEFAULT 0, + `last_used` datetime DEFAULT NULL, + `per_hour` int(10) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; CREATE TABLE IF NOT EXISTS `#__api_logs` ( -`id` bigint(20) NOT NULL AUTO_INCREMENT, - `hash` varchar(255) NOT NULL, - `ip_address` varchar(20) NOT NULL, - `time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `hash` varchar(255) NOT NULL DEFAULT '', + `ip_address` varchar(20) NOT NULL DEFAULT '', + `time` timestamp DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, `request_method` varchar(20) NOT NULL DEFAULT '', - `request` varchar(255) NOT NULL, - `post_data` text NOT NULL, + `request` varchar(255) NOT NULL DEFAULT '', + `post_data` text DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; diff --git a/code/site/libraries/plugin.php b/code/site/libraries/plugin.php index 71248f5..393e68b 100755 --- a/code/site/libraries/plugin.php +++ b/code/site/libraries/plugin.php @@ -77,7 +77,7 @@ public static function getInstance($name) $app = Factory::getApplication(); $param_path = JPATH_BASE . self::$plg_path . $name . '.xml'; $plugin = PluginHelper::getPlugin('api', $name); - PluginHelper::importPlugin("api"); + PluginHelper::importPlugin("api", $name); if (isset(self::$instances[$name])) { From a47a5731f5ff4586059b16450fdde909ba38a1cd Mon Sep 17 00:00:00 2001 From: ankush_m Date: Thu, 22 Sep 2022 17:31:13 +0530 Subject: [PATCH 4/7] Joomla 4 --- code/admin/sql/install.mysql.utf8.sql | 2 +- code/admin/sql/updates/mysql/3.0.0.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/admin/sql/install.mysql.utf8.sql b/code/admin/sql/install.mysql.utf8.sql index becbc3d..6b5b02f 100644 --- a/code/admin/sql/install.mysql.utf8.sql +++ b/code/admin/sql/install.mysql.utf8.sql @@ -18,7 +18,7 @@ CREATE TABLE IF NOT EXISTS `#__api_logs` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `hash` varchar(255) NOT NULL DEFAULT '', `ip_address` varchar(20) NOT NULL DEFAULT '', - `time` timestamp DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, + `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `request_method` varchar(20) NOT NULL DEFAULT '', `request` varchar(255) NOT NULL DEFAULT '', `post_data` text DEFAULT NULL, diff --git a/code/admin/sql/updates/mysql/3.0.0.sql b/code/admin/sql/updates/mysql/3.0.0.sql index e25953f..43566d4 100644 --- a/code/admin/sql/updates/mysql/3.0.0.sql +++ b/code/admin/sql/updates/mysql/3.0.0.sql @@ -11,7 +11,7 @@ ALTER TABLE `#__api_keys` CHANGE `per_hour` `per_hour` int(10) NOT NULL DEFAULT ALTER TABLE `#__api_logs` CHANGE `hash` `hash` varchar(255) NOT NULL DEFAULT ''; ALTER TABLE `#__api_logs` CHANGE `ip_address` `ip_address` varchar(20) NOT NULL DEFAULT ''; -ALTER TABLE `#__api_logs` CHANGE `time` `time` timestamp ON UPDATE CURRENT_TIMESTAMP; +ALTER TABLE `#__api_logs` CHANGE `time` `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; ALTER TABLE `#__api_logs` CHANGE `request_method` `request_method` varchar(20) NOT NULL DEFAULT ''; ALTER TABLE `#__api_logs` CHANGE `request` `request` varchar(255) NOT NULL DEFAULT ''; ALTER TABLE `#__api_logs` CHANGE `post_data` `post_data` text DEFAULT NULL; From 8b7dc124da7a04727ef2dd65dd117e79833e1b56 Mon Sep 17 00:00:00 2001 From: ankush_m Date: Tue, 11 Oct 2022 11:30:11 +0530 Subject: [PATCH 5/7] Bug #188735 fix: User able to login with wrong password as well --- code/site/libraries/authentication.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/site/libraries/authentication.php b/code/site/libraries/authentication.php index 2ed1107..b6198f6 100644 --- a/code/site/libraries/authentication.php +++ b/code/site/libraries/authentication.php @@ -75,7 +75,7 @@ public static function authenticateRequest() { self::setAuthError($auth_handler->getError()); - return Factory::getUser(); + return false; } else { From 28169cbd7334598a71a857f14b4cf483e8584f58 Mon Sep 17 00:00:00 2001 From: ankush_m Date: Tue, 11 Oct 2022 14:46:23 +0530 Subject: [PATCH 6/7] Version bump up --- code/api.xml | 4 ++-- code/plugins/authentication/tjapi/tjapi.xml | 4 ++-- code/plugins/system/tjtokenlogin/tjtokenlogin.xml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/code/api.xml b/code/api.xml index a44a530..1201912 100644 --- a/code/api.xml +++ b/code/api.xml @@ -1,13 +1,13 @@ com_api - 20th Sep 2022 + 11th Oct 2022 Copyright (C) 2009 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL Techjoomla extensions@techjoomla.com https://techjoomla.com - 3.0.1 + 3.0.2 Multi-purpose REST API framework for Joomla diff --git a/code/plugins/authentication/tjapi/tjapi.xml b/code/plugins/authentication/tjapi/tjapi.xml index 4af3a58..bc064f4 100644 --- a/code/plugins/authentication/tjapi/tjapi.xml +++ b/code/plugins/authentication/tjapi/tjapi.xml @@ -5,10 +5,10 @@ Techjoomla extensions@techjoomla.com https://techjoomla.com - 20th Sep 2022 + 11th Oct 2022 Copyright (C) 2009 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - 3.0.1 + 3.0.2 tjapi.php diff --git a/code/plugins/system/tjtokenlogin/tjtokenlogin.xml b/code/plugins/system/tjtokenlogin/tjtokenlogin.xml index e880522..1d5f2cd 100644 --- a/code/plugins/system/tjtokenlogin/tjtokenlogin.xml +++ b/code/plugins/system/tjtokenlogin/tjtokenlogin.xml @@ -5,10 +5,10 @@ Techjoomla extensions@techjoomla.com https://techjoomla.com - 20th Sep 2022 + 11th Oct 2022 Copyright (C) 2009 - 2019 Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - 3.0.1 + 3.0.2 tjtokenlogin.php From 2263d51071d1660202138d0c9ade5009f074e1d2 Mon Sep 17 00:00:00 2001 From: ankush_m Date: Tue, 11 Oct 2022 14:49:01 +0530 Subject: [PATCH 7/7] Version bumpup --- build/version.json | 4 ++-- scripts/jenkins-pipelines/nightly.groovy | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/version.json b/build/version.json index 177b848..37d992a 100644 --- a/build/version.json +++ b/build/version.json @@ -1,8 +1,8 @@ { "com_api": { - "3.0.0": { + "3.0.2": { "com_api": { - "version": "3.0.0", + "version": "3.0.2", "repoUrl": "git@github.com:techjoomla/com_api.git", "branch": "j4x" } diff --git a/scripts/jenkins-pipelines/nightly.groovy b/scripts/jenkins-pipelines/nightly.groovy index 327a6a8..5e69a2f 100644 --- a/scripts/jenkins-pipelines/nightly.groovy +++ b/scripts/jenkins-pipelines/nightly.groovy @@ -2,7 +2,7 @@ // Get / Set release name // TODO - remove hardcoded value -def apiVersion = '3.0.0' //env.getProperty("apiVersion") +def apiVersion = '3.0.2' //env.getProperty("apiVersion") echo apiVersion pipeline {