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
required:
- Identifier
- IsAdmin
type: object
models.UserInformation:
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": {
"get": {
"produces": [
@ -1373,6 +1417,15 @@
],
"summary": "Get peers for the given user.",
"operationId": "users_handlePeersGet",
"parameters": [
{
"type": "string",
"description": "The user identifier",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
@ -1408,6 +1461,15 @@
],
"summary": "Get peer stats for the given user.",
"operationId": "users_handleStatsGet",
"parameters": [
{
"type": "string",
"description": "The user identifier",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",

View File

@ -1262,9 +1262,45 @@ paths:
summary: Enable the REST API for the given user.
tags:
- 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:
get:
operationId: users_handlePeersGet
parameters:
- description: The user identifier
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
@ -1288,6 +1324,12 @@ paths:
/user/{id}/stats:
get:
operationId: users_handleStatsGet
parameters:
- description: The user identifier
in: path
name: id
required: true
type: string
produces:
- application/json
responses:

View File

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

View File

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

View File

@ -17,7 +17,7 @@ type User struct {
// The name of the authentication provider. This field is read-only.
ProviderName string `json:"ProviderName,omitempty" readonly:"true" example:""`
// 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.
Firstname string `json:"Firstname" example:"Max"`