Skip to content

[6.0] add cli usergroup id support#45433

Closed
tecpromotion wants to merge 9 commits intojoomla:6.0-devfrom
tecpromotion:feature/cli-usergroup-id-support
Closed

[6.0] add cli usergroup id support#45433
tecpromotion wants to merge 9 commits intojoomla:6.0-devfrom
tecpromotion:feature/cli-usergroup-id-support

Conversation

@tecpromotion
Copy link
Contributor

Summary of Changes

This PR extends the user:add CLI command to support assigning user groups either by name (as before) or by numeric ID (new).

The --usergroup option now accepts:
• a group name (e.g. "Super Users")
• a group ID (e.g. 8)
• or a comma-separated list of mixed values (e.g. "2,8,Registered")

Each value is internally checked:
• If it’s numeric and matches an existing ID → accepted
• If it matches an existing group name → accepted
• Otherwise → error

This provides a more flexible developer and automation experience, especially when working with provisioning tools.

Example CLI calls (all valid now):
php cli/joomla.php user:add \ --username="cliadmin" \ --password="Sup3rS3cur3_P4ssw0rt!" \ --email="stefan.wendhausen@community.joomla.org" \ --name="CLI User" \ --usergroup="8"

Testing Instructions

php cli/joomla.php user:add --username=test1 --password=abc123 --email=test1@community.joomla.org --name="Test User" --usergroup="8"

php cli/joomla.php user:add --username=test2 --password=abc123 --email=test2@community.joomla.org --name="Test User" --usergroup="Super Users"

php cli/joomla.php user:add --username=test3 --password=abc123 --email=test3@community.joomla.org --name="Test User" --usergroup="2,3"

php cli/joomla.php user:add --username=test4 --password=abc123 --email=test4@community.joomla.org --name="Test User" --usergroup="Registered,Author,8"

Actual result BEFORE applying this Pull Request

The parameter --usergroup does not work with a user group ID.

Expected result AFTER applying this Pull Request

An ID for a user group is accepted and the user is created.

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

tecpromotion and others added 2 commits May 5, 2025 18:21
Co-authored-by: Brian Teeman <brian@teeman.net>
Co-authored-by: Brian Teeman <brian@teeman.net>
@Bodge-IT
Copy link
Contributor

@tecpromotion Just a small nudge to get this over the line, then we can get tests arranged.

@ceford
Copy link
Contributor

ceford commented May 30, 2025

I have tested this item ✅ successfully on 9dcc28b


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

@muhme
Copy link
Contributor

muhme commented May 30, 2025

I'm wondering that ShortcutPlugin.cy.js failed three times when running Drone, in both System Tests; but it is passes local test (single and overall System Tests, HTTP and HTTPS in Docker container). Checking the System Tests log (simple to download) shows PHP Warning was found:

> [Fri May 30 16:46:26.805419 2025] [php:warn] [pid 51:tid 51] [client 127.0.0.1:45938] PHP Warning:  Undefined array key "status" in /tests/www/cmysql/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php on line 598, referer: https://localhost/cmysql/administrator/index.php

This code was introduced with PR 45143.
@laoneo Checking the logs is working 😄
@SniperSister Could you please take a look at this and give a fix in 5.4 so we can upmerge this in 6.0?
@richard67 fyi, we have the same issue in 5.4

Update: Fix is already in work:

The system test failure is unrelated from this PR and will be fixed in #45547

@bembelimen bembelimen added the bug label Aug 20, 2025
@tecpromotion tecpromotion deleted the feature/cli-usergroup-id-support branch August 31, 2025 16:35
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.

9 participants