[PR #5749] [MERGED] Create Admin Command: New Flags #6560

Closed
opened 2026-02-05 10:35:34 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/BookStackApp/BookStack/pull/5749
Author: @ssddanbrown
Created: 8/5/2025
Status: Merged
Merged: 8/30/2025
Merged by: @ssddanbrown

Base: developmentHead: admin_command_updates


📝 Commits (3)

  • a961552 Commands: Updated create admin comment to accept extra flags
  • 2eefbd2 Commands: Added testing for initial admin changes
  • f36e6fb Commands: Updated create admin skip return

📊 Changes

3 files changed (+287 additions, -33 deletions)

View changed files

📝 app/Console/Commands/CreateAdminCommand.php (+94 -22)
📝 app/Users/UserRepo.php (+17 -2)
📝 tests/Commands/CreateAdminCommandTest.php (+176 -9)

📄 Description

This adds flags to target changes to the first default admin user, and to generate a password.

Related to #4575.

New flags:

  • --generate-password: Generate a random password, and echo it back out as the only output on success.
  • --initial: Update the default admin@admin.com user if an existing admin, otherwise create a new admin user if there's no existing admin accounts.

When the --initial flag is given, the email and name of the account will default to admin@example.com and Admin if not provided (Allowing simpler default account creation in future). If the default admin does not exist with this flag, and an existing non-default admin already exists, then user creation will be skipped with a message and an exit code of 2.

Docs Updates

  • Details these flags and behaviours in the command line docs

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/BookStackApp/BookStack/pull/5749 **Author:** [@ssddanbrown](https://github.com/ssddanbrown) **Created:** 8/5/2025 **Status:** ✅ Merged **Merged:** 8/30/2025 **Merged by:** [@ssddanbrown](https://github.com/ssddanbrown) **Base:** `development` ← **Head:** `admin_command_updates` --- ### 📝 Commits (3) - [`a961552`](https://github.com/BookStackApp/BookStack/commit/a961552c23101bcf260aaf930a8362277852f67b) Commands: Updated create admin comment to accept extra flags - [`2eefbd2`](https://github.com/BookStackApp/BookStack/commit/2eefbd21c1cdb6a3b32529fd6db10f9bbfd4b9da) Commands: Added testing for initial admin changes - [`f36e6fb`](https://github.com/BookStackApp/BookStack/commit/f36e6fb929d50a2713d1b01f064f2f087188bb69) Commands: Updated create admin skip return ### 📊 Changes **3 files changed** (+287 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `app/Console/Commands/CreateAdminCommand.php` (+94 -22) 📝 `app/Users/UserRepo.php` (+17 -2) 📝 `tests/Commands/CreateAdminCommandTest.php` (+176 -9) </details> ### 📄 Description This adds flags to target changes to the first default admin user, and to generate a password. Related to #4575. New flags: - `--generate-password`: Generate a random password, and echo it back out as the only output on success. - `--initial`: Update the default `admin@admin.com` user if an existing admin, otherwise create a new admin user if there's no existing admin accounts. When the `--initial` flag is given, the email and name of the account will default to `admin@example.com` and `Admin` if not provided (Allowing simpler default account creation in future). If the default admin does not exist with this flag, and an existing non-default admin already exists, then user creation will be skipped with a message and an exit code of `2`. ### Docs Updates - Details these flags and behaviours in the command line docs --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 10:35:34 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#6560