api: remove IsAdmin from required attributes (#366)

This commit is contained in:
Christoph Haas 2025-02-17 07:40:24 +01:00
parent 5697c2b7f2
commit 43163273fa
6 changed files with 106 additions and 5 deletions

View File

@ -549,7 +549,6 @@ definitions:
type: string type: string
required: required:
- Identifier - Identifier
- IsAdmin
type: object type: object
models.UserInformation: models.UserInformation:
properties: properties:

View File

@ -1363,6 +1363,50 @@
} }
} }
}, },
"/user/{id}/interfaces": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "Get interfaces for the given user. Returns an empty list if self provisioning is disabled.",
"operationId": "users_handleInterfacesGet",
"parameters": [
{
"type": "string",
"description": "The user identifier",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/model.Interface"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/model.Error"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/model.Error"
}
}
}
}
},
"/user/{id}/peers": { "/user/{id}/peers": {
"get": { "get": {
"produces": [ "produces": [
@ -1373,6 +1417,15 @@
], ],
"summary": "Get peers for the given user.", "summary": "Get peers for the given user.",
"operationId": "users_handlePeersGet", "operationId": "users_handlePeersGet",
"parameters": [
{
"type": "string",
"description": "The user identifier",
"name": "id",
"in": "path",
"required": true
}
],
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",
@ -1408,6 +1461,15 @@
], ],
"summary": "Get peer stats for the given user.", "summary": "Get peer stats for the given user.",
"operationId": "users_handleStatsGet", "operationId": "users_handleStatsGet",
"parameters": [
{
"type": "string",
"description": "The user identifier",
"name": "id",
"in": "path",
"required": true
}
],
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",

View File

@ -1262,9 +1262,45 @@ paths:
summary: Enable the REST API for the given user. summary: Enable the REST API for the given user.
tags: tags:
- Users - Users
/user/{id}/interfaces:
get:
operationId: users_handleInterfacesGet
parameters:
- description: The user identifier
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/model.Interface'
type: array
"400":
description: Bad Request
schema:
$ref: '#/definitions/model.Error'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/model.Error'
summary: Get interfaces for the given user. Returns an empty list if self provisioning
is disabled.
tags:
- Users
/user/{id}/peers: /user/{id}/peers:
get: get:
operationId: users_handlePeersGet operationId: users_handlePeersGet
parameters:
- description: The user identifier
in: path
name: id
required: true
type: string
produces: produces:
- application/json - application/json
responses: responses:
@ -1288,6 +1324,12 @@ paths:
/user/{id}/stats: /user/{id}/stats:
get: get:
operationId: users_handleStatsGet operationId: users_handleStatsGet
parameters:
- description: The user identifier
in: path
name: id
required: true
type: string
produces: produces:
- application/json - application/json
responses: responses:

View File

@ -1998,8 +1998,7 @@
"models.User": { "models.User": {
"type": "object", "type": "object",
"required": [ "required": [
"Identifier", "Identifier"
"IsAdmin"
], ],
"properties": { "properties": {
"ApiEnabled": { "ApiEnabled": {

View File

@ -549,7 +549,6 @@ definitions:
type: string type: string
required: required:
- Identifier - Identifier
- IsAdmin
type: object type: object
models.UserInformation: models.UserInformation:
properties: properties:

View File

@ -17,7 +17,7 @@ type User struct {
// The name of the authentication provider. This field is read-only. // The name of the authentication provider. This field is read-only.
ProviderName string `json:"ProviderName,omitempty" readonly:"true" example:""` ProviderName string `json:"ProviderName,omitempty" readonly:"true" example:""`
// If this field is set, the user is an admin. // If this field is set, the user is an admin.
IsAdmin bool `json:"IsAdmin" binding:"required" example:"false"` IsAdmin bool `json:"IsAdmin" example:"false"`
// The first name of the user. This field is optional. // The first name of the user. This field is optional.
Firstname string `json:"Firstname" example:"Max"` Firstname string `json:"Firstname" example:"Max"`