mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-06-06 11:47:29 +02:00
Adapt swagger definitions of user update endpoint
This commit is contained in:
@@ -958,8 +958,11 @@
|
|||||||
"/api/user/{id}": {
|
"/api/user/{id}": {
|
||||||
"post": {
|
"post": {
|
||||||
"description": "Allows admins to add/remove roles and projects for a user",
|
"description": "Allows admins to add/remove roles and projects for a user",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
"produces": [
|
"produces": [
|
||||||
"text/plain"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"User"
|
"User"
|
||||||
@@ -974,35 +977,26 @@
|
|||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"description": "Single Field Changes",
|
||||||
"description": "Role to add",
|
"name": "request",
|
||||||
"name": "add-role",
|
"in": "body",
|
||||||
"in": "formData"
|
"required": true,
|
||||||
},
|
"schema": {
|
||||||
{
|
"$ref": "#/definitions/api.UpdateUserAPIRequest"
|
||||||
"type": "string",
|
}
|
||||||
"description": "Role to remove",
|
|
||||||
"name": "remove-role",
|
|
||||||
"in": "formData"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "string",
|
|
||||||
"description": "Project to add",
|
|
||||||
"name": "add-project",
|
|
||||||
"in": "formData"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "string",
|
|
||||||
"description": "Project to remove",
|
|
||||||
"name": "remove-project",
|
|
||||||
"in": "formData"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "Success message",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "string"
|
"$ref": "#/definitions/api.DefaultAPIResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/api.ErrorResponse"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"403": {
|
"403": {
|
||||||
@@ -1933,6 +1927,31 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"api.UpdateUserAPIRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"add-role": {
|
||||||
|
"description": "Role to add to user $ID",
|
||||||
|
"type": "string",
|
||||||
|
"example": "user"
|
||||||
|
},
|
||||||
|
"remove-role": {
|
||||||
|
"description": "Role to remove from user $ID",
|
||||||
|
"type": "string",
|
||||||
|
"example": "user"
|
||||||
|
},
|
||||||
|
"add-project": {
|
||||||
|
"description": "Project to add to user $ID managed array",
|
||||||
|
"type": "string",
|
||||||
|
"example": "abcd100"
|
||||||
|
},
|
||||||
|
"remove-project": {
|
||||||
|
"description": "Project to remove from user $ID managed array",
|
||||||
|
"type": "string",
|
||||||
|
"example": "abcd100"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"api.DefaultAPIResponse": {
|
"api.DefaultAPIResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
@@ -31,6 +31,25 @@ definitions:
|
|||||||
example: Debug
|
example: Debug
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
api.UpdateUserAPIRequest:
|
||||||
|
properties:
|
||||||
|
add-project:
|
||||||
|
description: Project to add to user $ID managed array
|
||||||
|
example: abcd100
|
||||||
|
type: string
|
||||||
|
add-role:
|
||||||
|
description: Role to add to user $ID
|
||||||
|
example: user
|
||||||
|
type: string
|
||||||
|
remove-project:
|
||||||
|
description: Project to remove from user $ID managed array
|
||||||
|
example: abcd100
|
||||||
|
type: string
|
||||||
|
remove-role:
|
||||||
|
description: Role to remove from user $ID
|
||||||
|
example: user
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
api.DefaultAPIResponse:
|
api.DefaultAPIResponse:
|
||||||
properties:
|
properties:
|
||||||
msg:
|
msg:
|
||||||
@@ -1388,6 +1407,8 @@ paths:
|
|||||||
- Nodestates
|
- Nodestates
|
||||||
/api/user/{id}:
|
/api/user/{id}:
|
||||||
post:
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
description: Allows admins to add/remove roles and projects for a user
|
description: Allows admins to add/remove roles and projects for a user
|
||||||
parameters:
|
parameters:
|
||||||
- description: Username
|
- description: Username
|
||||||
@@ -1395,29 +1416,23 @@ paths:
|
|||||||
name: id
|
name: id
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
- description: Role to add
|
- description: Single Field Changes
|
||||||
in: formData
|
in: body
|
||||||
name: add-role
|
name: request
|
||||||
type: string
|
required: true
|
||||||
- description: Role to remove
|
schema:
|
||||||
in: formData
|
$ref: '#/definitions/api.UpdateUserAPIRequest'
|
||||||
name: remove-role
|
|
||||||
type: string
|
|
||||||
- description: Project to add
|
|
||||||
in: formData
|
|
||||||
name: add-project
|
|
||||||
type: string
|
|
||||||
- description: Project to remove
|
|
||||||
in: formData
|
|
||||||
name: remove-project
|
|
||||||
type: string
|
|
||||||
produces:
|
produces:
|
||||||
- text/plain
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Success message
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
type: string
|
$ref: '#/definitions/api.DefaultAPIResponse'
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/api.ErrorResponse'
|
||||||
"403":
|
"403":
|
||||||
description: Forbidden
|
description: Forbidden
|
||||||
schema:
|
schema:
|
||||||
|
|||||||
@@ -965,8 +965,11 @@ const docTemplate = `{
|
|||||||
"/api/user/{id}": {
|
"/api/user/{id}": {
|
||||||
"post": {
|
"post": {
|
||||||
"description": "Allows admins to add/remove roles and projects for a user",
|
"description": "Allows admins to add/remove roles and projects for a user",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
"produces": [
|
"produces": [
|
||||||
"text/plain"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"User"
|
"User"
|
||||||
@@ -981,35 +984,26 @@ const docTemplate = `{
|
|||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"description": "Single Field Changes",
|
||||||
"description": "Role to add",
|
"name": "request",
|
||||||
"name": "add-role",
|
"in": "body",
|
||||||
"in": "formData"
|
"required": true,
|
||||||
},
|
"schema": {
|
||||||
{
|
"$ref": "#/definitions/api.UpdateUserAPIRequest"
|
||||||
"type": "string",
|
}
|
||||||
"description": "Role to remove",
|
|
||||||
"name": "remove-role",
|
|
||||||
"in": "formData"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "string",
|
|
||||||
"description": "Project to add",
|
|
||||||
"name": "add-project",
|
|
||||||
"in": "formData"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "string",
|
|
||||||
"description": "Project to remove",
|
|
||||||
"name": "remove-project",
|
|
||||||
"in": "formData"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "Success message",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "string"
|
"$ref": "#/definitions/api.DefaultAPIResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/api.ErrorResponse"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"403": {
|
"403": {
|
||||||
@@ -1940,6 +1934,31 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"api.UpdateUserAPIRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"add-role": {
|
||||||
|
"description": "Role to add to user $ID",
|
||||||
|
"type": "string",
|
||||||
|
"example": "user"
|
||||||
|
},
|
||||||
|
"remove-role": {
|
||||||
|
"description": "Role to remove from user $ID",
|
||||||
|
"type": "string",
|
||||||
|
"example": "user"
|
||||||
|
},
|
||||||
|
"add-project": {
|
||||||
|
"description": "Project to add to user $ID managed array",
|
||||||
|
"type": "string",
|
||||||
|
"example": "abcd100"
|
||||||
|
},
|
||||||
|
"remove-project": {
|
||||||
|
"description": "Project to remove from user $ID managed array",
|
||||||
|
"type": "string",
|
||||||
|
"example": "abcd100"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"api.DefaultAPIResponse": {
|
"api.DefaultAPIResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
Reference in New Issue
Block a user