Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.3] Add user argument to perform the cli command with a specific user #44618

Open
wants to merge 9 commits into
base: 5.3-dev
Choose a base branch
from

Conversation

laoneo
Copy link
Member

@laoneo laoneo commented Dec 13, 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 username 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 username 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

@brianteeman
Copy link
Contributor

Surely there must be some sort of authentication required

@laoneo
Copy link
Member Author

laoneo commented Dec 13, 2024

Not on cli

@richard67
Copy link
Member

@laoneo You saw that unit tests are failing?

@laoneo
Copy link
Member Author

laoneo commented Dec 14, 2024

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

@sandewt
Copy link
Contributor

sandewt commented Dec 14, 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

@laoneo
Copy link
Member Author

laoneo commented Dec 16, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants