VOOZH about

URL: https://deepwiki.com/MahoCommerce/maho/10.5-user-management-commands

⇱ User Management Commands | MahoCommerce/maho | DeepWiki


Loading...
Last indexed: 15 May 2026 (ea8ab8)
Menu

User Management Commands

This document covers the CLI commands for managing admin users and customers in Maho. These commands provide programmatic access to create, modify, list, and delete user accounts without using the web interface.

For information about the overall CLI architecture and command discovery, see CLI Architecture


Overview

Maho provides two categories of user management commands:

  1. Admin User Commands - Manage backend administrator accounts.
  2. Customer Commands - Manage frontend customer accounts.

All commands extend BaseMahoCommand lib/MahoCLI/Commands/BaseMahoCommand.php18-19 and use the Symfony Console framework for input/output handling. Commands are registered in the main CLI entry point maho maho28-42 or discovered via the CommandDiscoverer maho100-104

Command Registration Flow

Title: User Command Registration Architecture


Sources: lib/MahoCLI/Commands/BaseMahoCommand.php13-19 lib/MahoCLI/Commands/AdminUserChangepassword.php13-27 lib/MahoCLI/Commands/CustomerDelete.php13-29 maho28-42


Admin User Commands

Admin user commands operate on the backend administrator data and interact with the admin/user model. All admin commands require Maho to be initialized in admin mode via initMaho() lib/MahoCLI/Commands/BaseMahoCommand.php20-24

admin:user:list

Lists all administrator accounts with their basic information.

Execution Flow:

Title: Admin User List Flow


Sources: lib/MahoCLI/Commands/BaseMahoCommand.php20-24


admin:user:change-password

Changes the password of an existing admin user.

Command Attributes: Annotated with #[AsCommand(name: 'admin:user:change-password', ...)] lib/MahoCLI/Commands/AdminUserChangepassword.php23-26

Process:

  1. Prompt for username lib/MahoCLI/Commands/AdminUserChangepassword.php37-38
  2. Validate username is non-empty lib/MahoCLI/Commands/AdminUserChangepassword.php40-43
  3. Load user by username using Mage::getModel('admin/user')->loadByUsername($username) lib/MahoCLI/Commands/AdminUserChangepassword.php53-54
  4. Check if user exists via getUserId() lib/MahoCLI/Commands/AdminUserChangepassword.php55-58
  5. Prompt for new password lib/MahoCLI/Commands/AdminUserChangepassword.php45-46
  6. Set new password using setNewPassword($password) lib/MahoCLI/Commands/AdminUserChangepassword.php60
  7. Persist changes via save() lib/MahoCLI/Commands/AdminUserChangepassword.php61

Sources: lib/MahoCLI/Commands/AdminUserChangepassword.php30-66


admin:user:enable / disable

These commands toggle the is_active status of an administrator account.

Sequence for Status Change:

Title: Admin Status Update Sequence


Sources: lib/MahoCLI/Commands/AdminUserEnable.php30-58 lib/MahoCLI/Commands/AdminUserDisable.php30-58


Customer Commands

Customer commands operate on EAV entity tables and interact with Mage_Customer_Model_Customer.

customer:list

Lists all customers registered in the system.

Implementation Details:

Sources: lib/MahoCLI/Commands/CustomerList.php29-56

customer:delete

Deletes customer accounts with support for bulk deletion and email-based lookup lib/MahoCLI/Commands/CustomerDelete.php25-28

Implementation Details:

Title: Customer Deletion Logic


Sources: lib/MahoCLI/Commands/CustomerDelete.php31-103


Command Architecture

All user management commands share a common architecture based on BaseMahoCommand lib/MahoCLI/Commands/BaseMahoCommand.php18-19

Maho Initialization

The initMaho() method is critical for CLI operations lib/MahoCLI/Commands/BaseMahoCommand.php20-24:

Error Handling Patterns

Commands use standard return codes from Symfony\Component\Console\Command\Command:

Sources: lib/MahoCLI/Commands/BaseMahoCommand.php20-24 lib/MahoCLI/Commands/AdminUserChangepassword.php40-64