Tuesday, 04 April 2023
  1 Replies
  326 Visits
0
Votes
Undo
Although announced compatible with version 4 on the official extension page, the plugins and the documentation are not up to date.

Please, make it compatible to Joomla 4.
This is a great extension, easily customizable out of the box, and I am even surprised it's not a paid extension !

Tested (and reproducible) with Postman:

http://{{host}}/index.php?option=com_api&app=users&resource=login&format=raw
=> return HTTP 200, but does not return the logged user, and crashes if the request is sent with the authentication cookie (HTTP error 500)

http://{{host}}/index.php?option=com_api&app=users&resource=whoami
with the following code in users/whoami.php

class UsersApiResourceWhoAmI extends ApiResource
{
public function get()
{
$user = Factory::getUser();
$this->plugin->setResponse($user);
}

public function post()
{
$this->plugin->setResponse( Text::_( 'PLG_API_USERS_UNSUPPORTED_METHOD_POST' ));
}
}

=> supposed to return the logged user, or empty user (user->id with 0 if not logged) => crashes most of the time (HTTP error 500)

$this->user does not work as expected
=> it has to be replaced explicitly by Factory::getUser()

Bonus questions:
- Is there a way to change / extend the default response schema ?

{
"err_msg": "",
"err_code": "",
"response_id": "642c2ec043acd",
"api": "users.whoami",
"version": "",
"data": { }
}

- Could the documentation be extended with, among others, the methods of the plugin object (only the setResponse method is explained in the documentation) ?