Skip to content

Feature Request: User Creation Endpoint and CLI Command #980

@dcoric

Description

@dcoric

Is your feature request related to a problem? Please describe.

Currently, there's no programmatic way to create new users in the Git Proxy system. Administrators must manually create users through the database or UI, which is time-consuming and error-prone, especially when setting up multiple users or integrating with automated systems. This limitation makes it difficult to scale user management and integrate with other tools that might need to create users programmatically.

Describe the solution you'd like

I've implemented a new API endpoint and CLI command that allows administrators to create new users programmatically:

  1. API Endpoint: A new /api/auth/create-user endpoint that accepts POST requests with user details (username, password, email, gitAccount, and optional admin flag).

  2. CLI Command: A new create-user command for the Git Proxy CLI that provides a convenient way to create users from the command line.

Both implementations include proper authentication checks to ensure only administrators can create new users, validation of required fields, and appropriate error handling.

Describe alternatives you've considered

  1. Database Scripts: Creating a separate database script for user creation, but this would require direct database access and wouldn't integrate with the application's authentication system.

  2. UI-Only Solution: Adding a user creation form to the UI, but this wouldn't support programmatic user creation needed for automation.

Additional context

The implementation includes comprehensive tests for both the API endpoint and CLI command, covering:

  • Authentication requirements (only admins can create users)
  • Validation of required fields
  • Error handling for various scenarios
  • Successful user creation and verification

This feature enhances the system's usability for administrators and enables better integration with automated workflows and external systems.

Technical Details:

  • The API endpoint returns appropriate HTTP status codes (201 for success, 400 for validation errors, 401 for unauthorized access)
  • The CLI command provides clear error messages and exit codes for different failure scenarios
  • Both implementations maintain the existing security model where only administrators can create new users

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions