From 03591f0f95823a0b1dcca969d2a3ed505c7e6d73 Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Tue, 14 Mar 2023 03:45:21 -0400 Subject: add user rename endpoint to admin api (#22789) this is a simple endpoint that adds the ability to rename users to the admin API. Note: this is not in a mergeable state. It would be better if this was handled by a PATCH/POST to the /api/v1/admin/users/{username} endpoint and the username is modified. --------- Co-authored-by: Jason Song --- templates/swagger/v1_json.tmpl | 56 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'templates/swagger') diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index c304a7a497..7dc7f563c2 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -679,6 +679,46 @@ } } }, + "/admin/users/{username}/rename": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Rename a user", + "operationId": "adminRenameUser", + "parameters": [ + { + "type": "string", + "description": "existing username of user", + "name": "username", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RenameUserOption" + } + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, "/admin/users/{username}/repos": { "post": { "consumes": [ @@ -19105,6 +19145,22 @@ }, "x-go-package": "code.gitea.io/gitea/modules/structs" }, + "RenameUserOption": { + "description": "RenameUserOption options when renaming a user", + "type": "object", + "required": [ + "new_username" + ], + "properties": { + "new_username": { + "description": "New username for this user. This name cannot be in use yet by any other user.", + "type": "string", + "uniqueItems": true, + "x-go-name": "NewName" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, "RepoCollaboratorPermission": { "description": "RepoCollaboratorPermission to get repository permission for a collaborator", "type": "object", -- cgit v1.2.3