Skip to content

Commit 05cea7a

Browse files
Merge pull request #145 from techjoomla/j4x
J4x related bug fixes
2 parents ff989e9 + 41df3cc commit 05cea7a

File tree

11 files changed

+36
-34
lines changed

11 files changed

+36
-34
lines changed

build/version.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"com_api": {
3-
"3.0.0": {
3+
"3.0.2": {
44
"com_api": {
5-
"version": "3.0.0",
5+
"version": "3.0.2",
66
"repoUrl": "git@github.com:techjoomla/com_api.git",
77
"branch": "j4x"
88
}

code/admin/sql/install.mysql.utf8.sql

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
CREATE TABLE IF NOT EXISTS `#__api_keys` (
2-
`id` int(11) NOT NULL AUTO_INCREMENT,
3-
`userid` int(11) NOT NULL,
4-
`hash` varchar(255) NOT NULL,
5-
`domain` varchar(255) NOT NULL,
6-
`state` tinyint(1) NOT NULL,
7-
`checked_out` int(11) NOT NULL,
8-
`checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
9-
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
10-
`created_by` int(11) NOT NULL,
11-
`last_used` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
12-
`per_hour` int(10) NOT NULL,
2+
`id` int(11) NOT NULL AUTO_INCREMENT,
3+
`userid` int(11) NOT NULL DEFAULT 0,
4+
`hash` varchar(255) NOT NULL DEFAULT '',
5+
`domain` varchar(255) NOT NULL DEFAULT '',
6+
`state` tinyint(1) NOT NULL DEFAULT 0,
7+
`checked_out` int(11) NOT NULL DEFAULT 0,
8+
`checked_out_time` datetime DEFAULT NULL,
9+
`created` datetime DEFAULT NULL,
10+
`created_by` int(11) NOT NULL DEFAULT 0,
11+
`last_used` datetime DEFAULT NULL,
12+
`per_hour` int(10) NOT NULL DEFAULT 0,
1313
PRIMARY KEY (`id`)
1414
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
1515

1616

1717
CREATE TABLE IF NOT EXISTS `#__api_logs` (
18-
`id` bigint(20) NOT NULL AUTO_INCREMENT,
19-
`hash` varchar(255) NOT NULL,
20-
`ip_address` varchar(20) NOT NULL,
21-
`time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
18+
`id` bigint(20) NOT NULL AUTO_INCREMENT,
19+
`hash` varchar(255) NOT NULL DEFAULT '',
20+
`ip_address` varchar(20) NOT NULL DEFAULT '',
21+
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
2222
`request_method` varchar(20) NOT NULL DEFAULT '',
23-
`request` varchar(255) NOT NULL,
24-
`post_data` text NOT NULL,
23+
`request` varchar(255) NOT NULL DEFAULT '',
24+
`post_data` text DEFAULT NULL,
2525
PRIMARY KEY (`id`)
2626
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;

code/admin/sql/updates/mysql/3.0.0.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ALTER TABLE `#__api_keys` CHANGE `per_hour` `per_hour` int(10) NOT NULL DEFAULT
1111

1212
ALTER TABLE `#__api_logs` CHANGE `hash` `hash` varchar(255) NOT NULL DEFAULT '';
1313
ALTER TABLE `#__api_logs` CHANGE `ip_address` `ip_address` varchar(20) NOT NULL DEFAULT '';
14-
ALTER TABLE `#__api_logs` CHANGE `time` `time` timestamp ON UPDATE CURRENT_TIMESTAMP;
14+
ALTER TABLE `#__api_logs` CHANGE `time` `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
1515
ALTER TABLE `#__api_logs` CHANGE `request_method` `request_method` varchar(20) NOT NULL DEFAULT '';
1616
ALTER TABLE `#__api_logs` CHANGE `request` `request` varchar(255) NOT NULL DEFAULT '';
1717
ALTER TABLE `#__api_logs` CHANGE `post_data` `post_data` text DEFAULT NULL;

code/admin/tables/key.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Joomla\CMS\Factory;
1515
use Joomla\Registry\Registry;
1616
use Joomla\CMS\Language\Text;
17+
use Joomla\CMS\Access\Access;
1718

1819
/**
1920
* key Table class
@@ -87,8 +88,8 @@ public function bind($array, $ignore = '')
8788

8889
if (! Factory::getUser()->authorise('core.admin', 'com_api.key.' . $array['id']))
8990
{
90-
$actions = Factory::getACL()->getActions('com_api', 'key');
91-
$defaultActions = Factory::getACL()->getAssetRules('com_api.key.' . $array['id'])->getData();
91+
$actions = Access::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/com_api/access.xml', "/access/section[@name='key']/");
92+
$defaultActions = Access::getAssetRules('com_api.key.' . $array['id'])->getData();
9293
$arrayJaccess = array();
9394

9495
foreach ($actions as $action)

code/admin/tables/log.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Joomla\Data\DataObject;
1414
use Joomla\CMS\Factory;
1515
use Joomla\Registry\Registry;
16+
use Joomla\CMS\Access\Access;
1617

1718
/**
1819
* Log Table class
@@ -72,8 +73,8 @@ public function bind($array, $ignore = '')
7273

7374
if (! Factory::getUser()->authorise('core.admin', 'com_api.key.' . $array['id']))
7475
{
75-
$actions = Factory::getACL()->getActions('com_api', 'key');
76-
$defaultActions = Factory::getACL()->getAssetRules('com_api.key.' . $array['id'])->getData();
76+
$actions = Access::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/com_api/access.xml', "/access/section[@name='key']/");
77+
$defaultActions = Access::getAssetRules('com_api.key.' . $array['id'])->getData();
7778
$arrayJaccess = array();
7879

7980
foreach ($actions as $action)

code/api.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<extension type="component" version="3.0" method="upgrade">
33
<name>com_api</name>
4-
<creationDate>20th Sep 2022</creationDate>
4+
<creationDate>11th Oct 2022</creationDate>
55
<copyright>Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.</copyright>
66
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
77
<author>Techjoomla</author>
88
<authorEmail>extensions@techjoomla.com</authorEmail>
99
<authorUrl>https://techjoomla.com</authorUrl>
10-
<version>3.0.1</version>
10+
<version>3.0.2</version>
1111
<description>Multi-purpose REST API framework for Joomla</description>
1212
<install>
1313
<!-- Runs on install -->

code/plugins/authentication/tjapi/tjapi.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
<author>Techjoomla</author>
66
<authorEmail>extensions@techjoomla.com</authorEmail>
77
<authorUrl>https://techjoomla.com</authorUrl>
8-
<creationDate>20th Sep 2022</creationDate>
8+
<creationDate>11th Oct 2022</creationDate>
99
<copyright>Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.</copyright>
1010
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
11-
<version>3.0.1</version>
11+
<version>3.0.2</version>
1212

1313
<files>
1414
<filename plugin="tjapi">tjapi.php</filename>

code/plugins/system/tjtokenlogin/tjtokenlogin.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
<author>Techjoomla</author>
66
<authorEmail>extensions@techjoomla.com</authorEmail>
77
<authorUrl>https://techjoomla.com</authorUrl>
8-
<creationDate>20th Sep 2022</creationDate>
8+
<creationDate>11th Oct 2022</creationDate>
99
<copyright>Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.</copyright>
1010
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
11-
<version>3.0.1</version>
11+
<version>3.0.2</version>
1212

1313
<files>
1414
<filename plugin="tjtokenlogin">tjtokenlogin.php</filename>

code/site/libraries/authentication.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public static function authenticateRequest()
7575
{
7676
self::setAuthError($auth_handler->getError());
7777

78-
return Factory::getUser();
78+
return false;
7979
}
8080
else
8181
{

code/site/libraries/plugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public static function getInstance($name)
7777
$app = Factory::getApplication();
7878
$param_path = JPATH_BASE . self::$plg_path . $name . '.xml';
7979
$plugin = PluginHelper::getPlugin('api', $name);
80-
PluginHelper::importPlugin("api");
80+
PluginHelper::importPlugin("api", $name);
8181

8282
if (isset(self::$instances[$name]))
8383
{
@@ -497,7 +497,7 @@ final private function lastUsed()
497497
public function setResponse($data)
498498
{
499499
// For backward compatability -- TODO
500-
if (!isset($data->result))
500+
if (!isset($data->result) && !empty($data))
501501
{
502502
$data->result = clone $data;
503503
}

scripts/jenkins-pipelines/nightly.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// Get / Set release name
44
// TODO - remove hardcoded value
5-
def apiVersion = '3.0.0' //env.getProperty("apiVersion")
5+
def apiVersion = '3.0.2' //env.getProperty("apiVersion")
66
echo apiVersion
77

88
pipeline {

0 commit comments

Comments
 (0)