Skip to content

Commit

Permalink
api: remove IsAdmin from required attributes (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
h44z committed Feb 17, 2025
1 parent 5697c2b commit 4316327
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 5 deletions.
1 change: 0 additions & 1 deletion docs/documentation/rest-api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,6 @@ definitions:
type: string
required:
- Identifier
- IsAdmin
type: object
models.UserInformation:
properties:
Expand Down
62 changes: 62 additions & 0 deletions internal/app/api/core/assets/doc/v0_swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
42 changes: 42 additions & 0 deletions internal/app/api/core/assets/doc/v0_swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions internal/app/api/core/assets/doc/v1_swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1998,8 +1998,7 @@
"models.User": {
"type": "object",
"required": [
"Identifier",
"IsAdmin"
"Identifier"
],
"properties": {
"ApiEnabled": {
Expand Down
1 change: 0 additions & 1 deletion internal/app/api/core/assets/doc/v1_swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,6 @@ definitions:
type: string
required:
- Identifier
- IsAdmin
type: object
models.UserInformation:
properties:
Expand Down
2 changes: 1 addition & 1 deletion internal/app/api/v1/models/models_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit 4316327

Please sign in to comment.