Users-Group Update API (#49)

* Added structure to swagger

* Added updateUserGroups handlers

* Updated return definition for user groups.

* Logic rewrite

* Removed logs

* Added some tests to updateUserGroups

* lint fix

* Updated tests for the new API

* Lint

* Added comment about why we are setting this groups individually. & more lint fixes

* Updated tests page

* Added more tests & fixed comments for PR

* Lint utils file

* Fixed import orders

* Changed import order

Co-authored-by: Benjamin Perez <benjamin@bexsoft.net>
This commit is contained in:
Alex
2020-04-08 19:38:18 -05:00
committed by GitHub
parent ff2438a877
commit e197399441
16 changed files with 1043 additions and 14 deletions

View File

@@ -1069,6 +1069,45 @@ func init() {
}
}
}
},
"/users/{name}/groups": {
"put": {
"tags": [
"AdminAPI"
],
"summary": "Update Groups for a user",
"operationId": "UpdateUserGroups",
"parameters": [
{
"type": "string",
"name": "name",
"in": "path",
"required": true
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/updateUserGroups"
}
}
],
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/user"
}
},
"default": {
"description": "Generic error response.",
"schema": {
"$ref": "#/definitions/error"
}
}
}
}
}
},
"definitions": {
@@ -1591,6 +1630,20 @@ func init() {
}
}
},
"updateUserGroups": {
"type": "object",
"required": [
"groups"
],
"properties": {
"groups": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"user": {
"type": "object",
"properties": {
@@ -2661,6 +2714,45 @@ func init() {
}
}
}
},
"/users/{name}/groups": {
"put": {
"tags": [
"AdminAPI"
],
"summary": "Update Groups for a user",
"operationId": "UpdateUserGroups",
"parameters": [
{
"type": "string",
"name": "name",
"in": "path",
"required": true
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/updateUserGroups"
}
}
],
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/user"
}
},
"default": {
"description": "Generic error response.",
"schema": {
"$ref": "#/definitions/error"
}
}
}
}
}
},
"definitions": {
@@ -3183,6 +3275,20 @@ func init() {
}
}
},
"updateUserGroups": {
"type": "object",
"required": [
"groups"
],
"properties": {
"groups": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"user": {
"type": "object",
"properties": {