Skip to content

Feature Request: User Creation Endpoint and CLI Command #980

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

Open
dcoric opened this issue Apr 15, 2025 · 0 comments · May be fixed by #981
Open

Feature Request: User Creation Endpoint and CLI Command #980

dcoric opened this issue Apr 15, 2025 · 0 comments · May be fixed by #981

Comments

@dcoric
Copy link

dcoric commented Apr 15, 2025

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant