mirror of
https://github.com/azukaar/Cosmos-Server.git
synced 2026-05-20 12:29:55 -05:00
[release] v0.22.2
This commit is contained in:
@@ -3995,6 +3995,310 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/groups": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns all custom role groups (role ID >= 3)",
|
||||
"tags": [
|
||||
"groups"
|
||||
],
|
||||
"summary": "List all groups",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.APIResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Creates a new custom role group with name and permissions (Pro feature)",
|
||||
"tags": [
|
||||
"groups"
|
||||
],
|
||||
"summary": "Create a new group",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/pro.CreateGroupRequest"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Group creation details",
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.APIResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "Conflict",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/groups/{id}": {
|
||||
"put": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Updates an existing group's name or permissions (Pro feature)",
|
||||
"tags": [
|
||||
"groups"
|
||||
],
|
||||
"summary": "Update a group",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Group ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/pro.UpdateGroupRequest"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Fields to update",
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.APIResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "Conflict",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Deletes a custom role group. Fails if users are still assigned to it. (Pro feature)",
|
||||
"tags": [
|
||||
"groups"
|
||||
],
|
||||
"summary": "Delete a group",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Group ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.APIResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "Conflict",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/image/{name}": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -11076,6 +11380,37 @@
|
||||
"type": "integer",
|
||||
"format": "uint32"
|
||||
},
|
||||
"pro.CreateGroupRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"permissions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/utils.Permission"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"pro.UpdateGroupRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"permissions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/utils.Permission"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"storage.FormatDiskJSON": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
||||
@@ -3304,6 +3304,242 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/groups": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns all custom role groups (role ID \u003e= 3)",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"groups"
|
||||
],
|
||||
"summary": "List all groups",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.APIResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.HTTPErrorResult"
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Creates a new custom role group with name and permissions (Pro feature)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"groups"
|
||||
],
|
||||
"summary": "Create a new group",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Group creation details",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/pro.CreateGroupRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.APIResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.HTTPErrorResult"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.HTTPErrorResult"
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.HTTPErrorResult"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "Conflict",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/groups/{id}": {
|
||||
"put": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Updates an existing group's name or permissions (Pro feature)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"groups"
|
||||
],
|
||||
"summary": "Update a group",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Group ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Fields to update",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/pro.UpdateGroupRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.APIResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.HTTPErrorResult"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.HTTPErrorResult"
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.HTTPErrorResult"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.HTTPErrorResult"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "Conflict",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Deletes a custom role group. Fails if users are still assigned to it. (Pro feature)",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"groups"
|
||||
],
|
||||
"summary": "Delete a group",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Group ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.APIResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.HTTPErrorResult"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.HTTPErrorResult"
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.HTTPErrorResult"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.HTTPErrorResult"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "Conflict",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.HTTPErrorResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/image/{name}": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -9391,6 +9627,37 @@
|
||||
"ModePerm"
|
||||
]
|
||||
},
|
||||
"pro.CreateGroupRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"permissions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/utils.Permission"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"pro.UpdateGroupRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"permissions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/utils.Permission"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"storage.FormatDiskJSON": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
||||
@@ -1025,6 +1025,26 @@ definitions:
|
||||
- ModeIrregular
|
||||
- ModeType
|
||||
- ModePerm
|
||||
pro.CreateGroupRequest:
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
permissions:
|
||||
items:
|
||||
$ref: '#/definitions/utils.Permission'
|
||||
type: array
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
pro.UpdateGroupRequest:
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
permissions:
|
||||
items:
|
||||
$ref: '#/definitions/utils.Permission'
|
||||
type: array
|
||||
type: object
|
||||
storage.FormatDiskJSON:
|
||||
properties:
|
||||
disk:
|
||||
@@ -4069,6 +4089,159 @@ paths:
|
||||
summary: Get backup file
|
||||
tags:
|
||||
- config
|
||||
/api/groups:
|
||||
get:
|
||||
description: Returns all custom role groups (role ID >= 3)
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/utils.APIResponse'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/utils.HTTPErrorResult'
|
||||
"403":
|
||||
description: Forbidden
|
||||
schema:
|
||||
$ref: '#/definitions/utils.HTTPErrorResult'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: List all groups
|
||||
tags:
|
||||
- groups
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Creates a new custom role group with name and permissions (Pro
|
||||
feature)
|
||||
parameters:
|
||||
- description: Group creation details
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/pro.CreateGroupRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/utils.APIResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/utils.HTTPErrorResult'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/utils.HTTPErrorResult'
|
||||
"403":
|
||||
description: Forbidden
|
||||
schema:
|
||||
$ref: '#/definitions/utils.HTTPErrorResult'
|
||||
"409":
|
||||
description: Conflict
|
||||
schema:
|
||||
$ref: '#/definitions/utils.HTTPErrorResult'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Create a new group
|
||||
tags:
|
||||
- groups
|
||||
/api/groups/{id}:
|
||||
delete:
|
||||
description: Deletes a custom role group. Fails if users are still assigned
|
||||
to it. (Pro feature)
|
||||
parameters:
|
||||
- description: Group ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/utils.APIResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/utils.HTTPErrorResult'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/utils.HTTPErrorResult'
|
||||
"403":
|
||||
description: Forbidden
|
||||
schema:
|
||||
$ref: '#/definitions/utils.HTTPErrorResult'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/utils.HTTPErrorResult'
|
||||
"409":
|
||||
description: Conflict
|
||||
schema:
|
||||
$ref: '#/definitions/utils.HTTPErrorResult'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Delete a group
|
||||
tags:
|
||||
- groups
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Updates an existing group's name or permissions (Pro feature)
|
||||
parameters:
|
||||
- description: Group ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: Fields to update
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/pro.UpdateGroupRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/utils.APIResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/utils.HTTPErrorResult'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/utils.HTTPErrorResult'
|
||||
"403":
|
||||
description: Forbidden
|
||||
schema:
|
||||
$ref: '#/definitions/utils.HTTPErrorResult'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/utils.HTTPErrorResult'
|
||||
"409":
|
||||
description: Conflict
|
||||
schema:
|
||||
$ref: '#/definitions/utils.HTTPErrorResult'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Update a group
|
||||
tags:
|
||||
- groups
|
||||
/api/image/{name}:
|
||||
get:
|
||||
description: Returns a previously uploaded image by name
|
||||
|
||||
+934
-287
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -8,7 +8,7 @@ git add api-docs/ go-sdk/client.gen.go go-sdk/version.go
|
||||
# --- Pro leak check ---
|
||||
errors=0
|
||||
|
||||
for dir in "src/pro" "client/src/pro"; do
|
||||
for dir in "client/src/pro"; do
|
||||
count=$(find "$dir" -type f | wc -l)
|
||||
if [ "$count" -ne 1 ]; then
|
||||
echo "ERROR: $dir/ must contain exactly 1 file, found $count"
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
package pro
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/azukaar/cosmos-server/src/utils"
|
||||
)
|
||||
|
||||
type CreateGroupRequest struct {
|
||||
Name string `json:"name" validate:"required"`
|
||||
Permissions []utils.Permission `json:"permissions"`
|
||||
}
|
||||
|
||||
type UpdateGroupRequest struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Permissions []utils.Permission `json:"permissions,omitempty"`
|
||||
}
|
||||
|
||||
func GroupsRoute(w http.ResponseWriter, req *http.Request) {
|
||||
utils.Error("This is a pro and is not currently available on your server. Please upgrade to Cosmos Pro to access this feature.", nil)
|
||||
utils.HTTPError(w, "This feature is only available in Cosmos Pro", http.StatusForbidden, "PRO001")
|
||||
return
|
||||
}
|
||||
|
||||
func GroupsIdRoute(w http.ResponseWriter, req *http.Request) {
|
||||
if req.Method == "PUT" {
|
||||
updateGroup(w, req)
|
||||
} else if req.Method == "DELETE" {
|
||||
deleteGroup(w, req)
|
||||
} else {
|
||||
utils.Error("GroupsIdRoute: Method not allowed "+req.Method, nil)
|
||||
utils.HTTPError(w, "Method not allowed", http.StatusMethodNotAllowed, "HTTP001")
|
||||
}
|
||||
}
|
||||
|
||||
// listGroups godoc
|
||||
// @Summary List all groups
|
||||
// @Description Returns all custom role groups (role ID >= 3)
|
||||
// @Tags groups
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Success 200 {object} utils.APIResponse
|
||||
// @Failure 401 {object} utils.HTTPErrorResult
|
||||
// @Failure 403 {object} utils.HTTPErrorResult
|
||||
// @Router /api/groups [get]
|
||||
func listGroups(w http.ResponseWriter, req *http.Request) {
|
||||
utils.Error("This is a pro and is not currently available on your server. Please upgrade to Cosmos Pro to access this feature.", nil)
|
||||
utils.HTTPError(w, "This feature is only available in Cosmos Pro", http.StatusForbidden, "PRO001")
|
||||
return
|
||||
}
|
||||
|
||||
// createGroup godoc
|
||||
// @Summary Create a new group
|
||||
// @Description Creates a new custom role group with name and permissions (Pro feature)
|
||||
// @Tags groups
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Param request body CreateGroupRequest true "Group creation details"
|
||||
// @Success 200 {object} utils.APIResponse
|
||||
// @Failure 400 {object} utils.HTTPErrorResult
|
||||
// @Failure 401 {object} utils.HTTPErrorResult
|
||||
// @Failure 403 {object} utils.HTTPErrorResult
|
||||
// @Failure 409 {object} utils.HTTPErrorResult
|
||||
// @Router /api/groups [post]
|
||||
func createGroup(w http.ResponseWriter, req *http.Request) {
|
||||
utils.Error("This is a pro and is not currently available on your server. Please upgrade to Cosmos Pro to access this feature.", nil)
|
||||
utils.HTTPError(w, "This feature is only available in Cosmos Pro", http.StatusForbidden, "PRO001")
|
||||
return
|
||||
}
|
||||
|
||||
// updateGroup godoc
|
||||
// @Summary Update a group
|
||||
// @Description Updates an existing group's name or permissions (Pro feature)
|
||||
// @Tags groups
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Param id path int true "Group ID"
|
||||
// @Param request body UpdateGroupRequest true "Fields to update"
|
||||
// @Success 200 {object} utils.APIResponse
|
||||
// @Failure 400 {object} utils.HTTPErrorResult
|
||||
// @Failure 401 {object} utils.HTTPErrorResult
|
||||
// @Failure 403 {object} utils.HTTPErrorResult
|
||||
// @Failure 404 {object} utils.HTTPErrorResult
|
||||
// @Failure 409 {object} utils.HTTPErrorResult
|
||||
// @Router /api/groups/{id} [put]
|
||||
func updateGroup(w http.ResponseWriter, req *http.Request) {
|
||||
utils.Error("This is a pro and is not currently available on your server. Please upgrade to Cosmos Pro to access this feature.", nil)
|
||||
utils.HTTPError(w, "This feature is only available in Cosmos Pro", http.StatusForbidden, "PRO001")
|
||||
return
|
||||
}
|
||||
|
||||
// deleteGroup godoc
|
||||
// @Summary Delete a group
|
||||
// @Description Deletes a custom role group. Fails if users are still assigned to it. (Pro feature)
|
||||
// @Tags groups
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Param id path int true "Group ID"
|
||||
// @Success 200 {object} utils.APIResponse
|
||||
// @Failure 400 {object} utils.HTTPErrorResult
|
||||
// @Failure 401 {object} utils.HTTPErrorResult
|
||||
// @Failure 403 {object} utils.HTTPErrorResult
|
||||
// @Failure 404 {object} utils.HTTPErrorResult
|
||||
// @Failure 409 {object} utils.HTTPErrorResult
|
||||
// @Router /api/groups/{id} [delete]
|
||||
func deleteGroup(w http.ResponseWriter, req *http.Request) {
|
||||
utils.Error("This is a pro and is not currently available on your server. Please upgrade to Cosmos Pro to access this feature.", nil)
|
||||
utils.HTTPError(w, "This feature is only available in Cosmos Pro", http.StatusForbidden, "PRO001")
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user