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/code/admin/sql/install.mysql.utf8.sql b/code/admin/sql/install.mysql.utf8.sql index a0f1889..6b5b02f 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 NOT NULL DEFAULT CURRENT_TIMESTAMP 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/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; 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) 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 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 { diff --git a/code/site/libraries/plugin.php b/code/site/libraries/plugin.php index 9af3bb9..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])) { @@ -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; } 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 {