Feature Unit/System Tests Maintainers Checked PR-6.0-dev Pending

User tests: Successful: Unsuccessful:

avatar laoneo
laoneo
13 Dec 2024

Summary of Changes

Sometimes is a user needed when running console commands. As cli per se doesn't know a user, this pr adds a new user argument, when set, does the console application load a user object before executing the command. The argument has the name --user and accepts either the user id or username.

Testing Instructions without the patch

  • Create a user with the username test and a normal password which is not "newpw".
  • Change the password of a user with the following command:
    php cli/joomla.php user:reset-password --username test --password newpw

Testing Instructions with the patch

  • Create a user with the username test and a normal password which is not "newpw".
  • Change the password of a user on the console with the new --user argument (replace manager with a username from your system):
    php cli/joomla.php user:reset-password --user manager --username test --password newpw
  • Login on the front with the username test and password newpw.

Actual result BEFORE applying this Pull Request

The password got changed but no action log entry was made and log in on the front is possible.

Expected result AFTER applying this Pull Request

The password got changed and an action log entry was made for the user manager that he changed the user test and log in on the front is possible.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar laoneo laoneo - open - 13 Dec 2024
avatar laoneo laoneo - change - 13 Dec 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 13 Dec 2024
Category Libraries
avatar brianteeman
brianteeman - comment - 13 Dec 2024

Surely there must be some sort of authentication required

avatar laoneo
laoneo - comment - 13 Dec 2024

Not on cli

avatar richard67
richard67 - comment - 14 Dec 2024

@laoneo You saw that unit tests are failing?

avatar laoneo
laoneo - comment - 14 Dec 2024

Yes, as long as we are still discussing things I will not make more changes

avatar laoneo laoneo - change - 14 Dec 2024
Labels Added: PR-5.3-dev
avatar sandewt
sandewt - comment - 14 Dec 2024

This is what I see before and with the pr. (User 605 is an existing user.)
Is this the exact intention of this pr?

Schermafbeelding 2024-12-14 131852

avatar laoneo laoneo - change - 16 Dec 2024
The description was changed
avatar laoneo laoneo - edited - 16 Dec 2024
avatar laoneo
laoneo - comment - 16 Dec 2024

This is correct. But I changed the code and to have a more real world test scenario.

avatar joomla-cms-bot joomla-cms-bot - change - 16 Dec 2024
Category Libraries CLI Libraries
avatar laoneo laoneo - change - 17 Dec 2024
The description was changed
avatar laoneo laoneo - edited - 17 Dec 2024
avatar laoneo laoneo - change - 7 Jan 2025
Labels Added: Feature
avatar rdeutz
rdeutz - comment - 10 Jan 2025

Looks good to me

avatar laoneo laoneo - change - 10 Jan 2025
Labels Added: Maintainers Checked
avatar alikon
alikon - comment - 10 Jan 2025

i've made this test from cli

image

where --user adminnotexists doesn't exist , i think if passed must be checked

the password has been changed successfully

image

when i checked in the backend action log

image

it report wrong action and wrong user who peformed the cli command

avatar laoneo
laoneo - comment - 11 Jan 2025

Added an extra check, so the user will only be loaded when it is not a guest in the console application.

avatar VaishnaviSidral VaishnaviSidral - test_item - 22 Feb 2025 - Tested unsuccessfully
avatar VaishnaviSidral
VaishnaviSidral - comment - 22 Feb 2025

I have tested this item 🔴 unsuccessfully on 9390dea

There is an inconsistency: the test instructions without patch mention resetting the password, but the actual result states the username was changed.
Additionally, after applying the patch, I tested and confirmed that the password was changed, and the user could log in from the frontend, but no action log entry was recorded.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44618.

avatar nileshmittha nileshmittha - test_item - 22 Feb 2025 - Tested unsuccessfully
avatar nileshmittha
nileshmittha - comment - 22 Feb 2025

I have tested this item 🔴 unsuccessfully on 9390dea

the instructions refer to resetting the password, but the result indicates a username change. After applying the patch, I verified the password was updated, the user could log in, but no action log was recorded


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44618.

avatar laoneo laoneo - change - 4 Mar 2025
The description was changed
avatar laoneo laoneo - edited - 4 Mar 2025
avatar laoneo
laoneo - comment - 4 Mar 2025

How did you guys check for an action log entry?

avatar HLeithner
HLeithner - comment - 4 Mar 2025

This pull request has been automatically rebased to 6.0-dev.

avatar HLeithner HLeithner - change - 4 Mar 2025
Title
[5.3] Add user argument to perform the cli command with a specific user
[6.0] Add user argument to perform the cli command with a specific user
avatar HLeithner HLeithner - edited - 4 Mar 2025
avatar joomla-cms-bot joomla-cms-bot - change - 4 Mar 2025
Category Libraries CLI Administration SQL com_admin Postgresql com_associations com_banners com_categories com_checkin com_config com_contact com_content com_contenthistory com_cpanel com_fields com_finder com_installer com_joomlaupdate
avatar laoneo laoneo - change - 28 Mar 2025
Labels Added: PR-6.0-dev
Removed: PR-5.3-dev
avatar joomla-cms-bot joomla-cms-bot - change - 28 Mar 2025
Category Administration SQL com_admin Postgresql com_associations com_banners com_categories com_checkin com_config com_contact com_content com_contenthistory com_cpanel com_fields com_finder com_installer com_joomlaupdate CLI Libraries
avatar stutteringp0et
stutteringp0et - comment - 6 Apr 2025

@brianteeman pointed out this PR related to an issue I reported, and suggested that it required testing. I'm not sure I understand what stage this is at and/or if I can help in any way. I thought the 2 failed checks were some kind of roadblock - but looking at them, they don't appear to be related to the changes in this PR.

What does that status mean for the PR, and is there anything I can do to help?

avatar laoneo
laoneo - comment - 7 Apr 2025

These changes have heen for 6.0 but they tested it on 5.3. That's why they failed. If you use the package from uere, then you should be able to properly test it.

avatar stutteringp0et
stutteringp0et - comment - 9 Apr 2025

I haven't yet tested this against MY application/need (loading plugins with higher access levels than public), but going over the described tests above, it does seem to perform as described. When I call user:add with the --user= flag, Latest Actions shows the created user.

I do have one question though. I also called user:add WITHOUT the --user= flag, and was still able to create the user. Is that intended? I mean, it makes sense for backwards compatibility for it to run as it does in J5 - without a user, but I just want to be sure this is intended before I claim a successful test.

avatar laoneo
laoneo - comment - 9 Apr 2025

The behavior should be the same, when no user is specified. So your assumption is correct.

avatar stutteringp0et
stutteringp0et - comment - 9 Apr 2025

Great! Successful test then.

I have a separate comment, however, on the functionality. I have a CLI that calls a plugin event. If this plugin is in any access level other than public - it doesn't fire, even with this PR.

$this->app = Factory::getApplication();
$this->dispatcher = $this->app->getDispatcher();
PluginHelper::importPlugin('content','indexingapi',true, $this->dispatcher);
$event = AbstractEvent::create('onContentAfterSave', $contentEventArguments);
$this->dispatcher->dispatch('onContentAfterSave', $event);

As soon as I switch the access level of the plugin to Public - it works just fine.

This behavior was reported in PR #16314 but was closed before any progress was made. I thought (hoped) your PR would solve this problem as well.

avatar richard67
richard67 - comment - 9 Apr 2025

Great! Successful test then.

@stutteringp0et Then go to this PR in the issue tracker here https://issues.joomla.org/tracker/joomla-cms/44618 , use the blue „Test this“ button, select your test result and submit. Thanks in advance.

avatar stutteringp0et stutteringp0et - test_item - 9 Apr 2025 - Tested successfully
avatar stutteringp0et
stutteringp0et - comment - 9 Apr 2025

I have tested this item ✅ successfully on 46193e8


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44618.

avatar joomla-cms-bot joomla-cms-bot - change - 30 Apr 2025
Category CLI Libraries CLI Libraries JavaScript Unit Tests
avatar laoneo laoneo - change - 30 Apr 2025
Labels Added: Unit/System Tests
avatar laoneo laoneo - change - 26 May 2025
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2025-05-26 07:23:58
Closed_By laoneo
avatar laoneo laoneo - close - 26 May 2025

Add a Comment

Login with GitHub to post a comment