Skip to content

Commit

Permalink
Merge pull request techjoomla#145 from techjoomla/j4x
Browse files Browse the repository at this point in the history
J4x related bug fixes
  • Loading branch information
ankush-maherwal authored Oct 12, 2022
2 parents ff989e9 + 41df3cc commit 05cea7a
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 34 deletions.
4 changes: 2 additions & 2 deletions build/version.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"com_api": {
"3.0.0": {
"3.0.2": {
"com_api": {
"version": "3.0.0",
"version": "3.0.2",
"repoUrl": "[email protected]:techjoomla/com_api.git",
"branch": "j4x"
}
Expand Down
34 changes: 17 additions & 17 deletions code/admin/sql/install.mysql.utf8.sql
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 1 addition & 1 deletion code/admin/sql/updates/mysql/3.0.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;
5 changes: 3 additions & 2 deletions code/admin/tables/key.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions code/admin/tables/log.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Joomla\Data\DataObject;
use Joomla\CMS\Factory;
use Joomla\Registry\Registry;
use Joomla\CMS\Access\Access;

/**
* Log Table class
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions code/api.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.0" method="upgrade">
<name>com_api</name>
<creationDate>20th Sep 2022</creationDate>
<creationDate>11th Oct 2022</creationDate>
<copyright>Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<author>Techjoomla</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://techjoomla.com</authorUrl>
<version>3.0.1</version>
<version>3.0.2</version>
<description>Multi-purpose REST API framework for Joomla</description>
<install>
<!-- Runs on install -->
Expand Down
4 changes: 2 additions & 2 deletions code/plugins/authentication/tjapi/tjapi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<author>Techjoomla</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://techjoomla.com</authorUrl>
<creationDate>20th Sep 2022</creationDate>
<creationDate>11th Oct 2022</creationDate>
<copyright>Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<version>3.0.1</version>
<version>3.0.2</version>

<files>
<filename plugin="tjapi">tjapi.php</filename>
Expand Down
4 changes: 2 additions & 2 deletions code/plugins/system/tjtokenlogin/tjtokenlogin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<author>Techjoomla</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://techjoomla.com</authorUrl>
<creationDate>20th Sep 2022</creationDate>
<creationDate>11th Oct 2022</creationDate>
<copyright>Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<version>3.0.1</version>
<version>3.0.2</version>

<files>
<filename plugin="tjtokenlogin">tjtokenlogin.php</filename>
Expand Down
2 changes: 1 addition & 1 deletion code/site/libraries/authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static function authenticateRequest()
{
self::setAuthError($auth_handler->getError());

return Factory::getUser();
return false;
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions code/site/libraries/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
{
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/jenkins-pipelines/nightly.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 05cea7a

Please sign in to comment.