some changes

This commit is contained in:
2025-12-21 00:00:03 +02:00
parent 904f446447
commit 85f8ac60e7
14 changed files with 678 additions and 1475 deletions

View File

@@ -30,15 +30,18 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"key": {
"type": "string",
"example": "html.view"
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"key": {
"type": "string",
"example": "html.view"
}
}
}
}
@@ -47,7 +50,7 @@ const docTemplate = `{
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -84,19 +87,19 @@ const docTemplate = `{
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.createResourceErrorInvalidResourceKey"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.createResourceErrorResourceAlreadyExists"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -131,19 +134,19 @@ const docTemplate = `{
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.getResourceErrorInvalidResourceID"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.getResourceErrorResourceNotFound"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -173,25 +176,25 @@ const docTemplate = `{
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.deleteResourceErrorInvalidResourceID"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.deleteResourceErrorResourceNotFound"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.deleteResourceErrorResourceInUse"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -236,25 +239,25 @@ const docTemplate = `{
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.updateResourceErrorInvalidResourceKey"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.updateResourceErrorResourceNotFound"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.updateResourceErrorResourceKeyAlreadyExists"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -275,15 +278,18 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"name": {
"type": "string",
"example": "admin"
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"name": {
"type": "string",
"example": "admin"
}
}
}
}
@@ -292,7 +298,7 @@ const docTemplate = `{
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -329,25 +335,19 @@ const docTemplate = `{
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInvalidRequestBody"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api_acladmin.createRoleErrorInvalidRoleName"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.createRoleErrorRoleAlreadyExists"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -382,19 +382,19 @@ const docTemplate = `{
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.getRoleErrorInvalidRoleID"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.getRoleErrorRoleNotFound"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -424,25 +424,25 @@ const docTemplate = `{
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.deleteRoleErrorInvalidRoleID"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.deleteRoleErrorRoleNotFound"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.deleteRoleErrorRoleInUse"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -487,25 +487,78 @@ const docTemplate = `{
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.updateRoleErrorInvalidRoleName"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.updateRoleErrorRoleNotFound"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.updateRoleErrorRoleNameAlreadyExists"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
}
},
"/api/acl/roles/{roleId}/users": {
"get": {
"produces": [
"application/json"
],
"tags": [
"roles"
],
"summary": "Get role users",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "Role ID",
"name": "roleId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/api_acladmin.getRoleUser"
}
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -513,29 +566,28 @@ const docTemplate = `{
}
},
"definitions": {
"api_acladmin.createResourceErrorInvalidResourceKey": {
"api_acladmin.ProblemDetails": {
"type": "object",
"properties": {
"details": {
"detail": {
"type": "string",
"example": "Invalid resource key"
"example": "No role with ID 42"
},
"error": {
"instance": {
"type": "string",
"example": "FAILED_TO_CREATE_RESOURCE"
}
}
},
"api_acladmin.createResourceErrorResourceAlreadyExists": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Resource with key 'html.view' already exists"
"example": "/api/acl/roles/42"
},
"error": {
"status": {
"type": "integer",
"example": 404
},
"title": {
"type": "string",
"example": "FAILED_TO_CREATE_RESOURCE"
"example": "Role not found"
},
"type": {
"type": "string",
"example": "https://api.triggerssmith.com/errors/role-not-found"
}
}
},
@@ -561,32 +613,6 @@ const docTemplate = `{
}
}
},
"api_acladmin.createRoleErrorInvalidRoleName": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Invalid role name"
},
"error": {
"type": "string",
"example": "FAILED_TO_CREATE_ROLE"
}
}
},
"api_acladmin.createRoleErrorRoleAlreadyExists": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Role with name 'admin' already exists"
},
"error": {
"type": "string",
"example": "FAILED_TO_CREATE_ROLE"
}
}
},
"api_acladmin.createRoleRequest": {
"type": "object",
"properties": {
@@ -609,134 +635,6 @@ const docTemplate = `{
}
}
},
"api_acladmin.deleteResourceErrorInvalidResourceID": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Resource ID must be positive integer"
},
"error": {
"type": "string",
"example": "INVALID_RESOURCE_ID"
}
}
},
"api_acladmin.deleteResourceErrorResourceInUse": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Resource with ID 123 is used and cannot be deleted"
},
"error": {
"type": "string",
"example": "FAILED_TO_DELETE_RESOURCE"
}
}
},
"api_acladmin.deleteResourceErrorResourceNotFound": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "No resource with ID 123"
},
"error": {
"type": "string",
"example": "RESOURCE_NOT_FOUND"
}
}
},
"api_acladmin.deleteRoleErrorInvalidRoleID": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Role ID must be positive integer"
},
"error": {
"type": "string",
"example": "INVALID_ROLE_ID"
}
}
},
"api_acladmin.deleteRoleErrorRoleInUse": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Role with ID 123 is assigned to users and cannot be deleted"
},
"error": {
"type": "string",
"example": "FAILED_TO_DELETE_ROLE"
}
}
},
"api_acladmin.deleteRoleErrorRoleNotFound": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "No role with ID 123"
},
"error": {
"type": "string",
"example": "ROLE_NOT_FOUND"
}
}
},
"api_acladmin.errorInternalServerError": {
"type": "object",
"properties": {
"details": {
"type": "string"
},
"error": {
"type": "string"
}
}
},
"api_acladmin.errorInvalidRequestBody": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Request body is not valid JSON"
},
"error": {
"type": "string",
"example": "INVALID_REQUEST_BODY"
}
}
},
"api_acladmin.getResourceErrorInvalidResourceID": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Resource ID must be positive integer"
},
"error": {
"type": "string",
"example": "INVALID_RESOURCE_ID"
}
}
},
"api_acladmin.getResourceErrorResourceNotFound": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "No resource with ID 123"
},
"error": {
"type": "string",
"example": "RESOURCE_NOT_FOUND"
}
}
},
"api_acladmin.getResourceResponse": {
"type": "object",
"properties": {
@@ -750,32 +648,6 @@ const docTemplate = `{
}
}
},
"api_acladmin.getRoleErrorInvalidRoleID": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Role ID must be positive integer"
},
"error": {
"type": "string",
"example": "INVALID_ROLE_ID"
}
}
},
"api_acladmin.getRoleErrorRoleNotFound": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "No role with ID 123"
},
"error": {
"type": "string",
"example": "ROLE_NOT_FOUND"
}
}
},
"api_acladmin.getRoleResponse": {
"type": "object",
"properties": {
@@ -789,55 +661,20 @@ const docTemplate = `{
}
}
},
"api_acladmin.updateResourceErrorInvalidResourceID": {
"api_acladmin.getRoleUser": {
"type": "object",
"properties": {
"details": {
"userEmail": {
"type": "string",
"example": "Resource ID must be positive integer"
"example": "admin@triggerssmith.com"
},
"error": {
"type": "string",
"example": "INVALID_RESOURCE_ID"
}
}
},
"api_acladmin.updateResourceErrorInvalidResourceKey": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Invalid resource key"
"userId": {
"type": "integer",
"example": 1
},
"error": {
"userName": {
"type": "string",
"example": "FAILED_TO_UPDATE_RESOURCE"
}
}
},
"api_acladmin.updateResourceErrorResourceKeyAlreadyExists": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Resource with key 'html.view' already exists"
},
"error": {
"type": "string",
"example": "FAILED_TO_UPDATE_RESOURCE"
}
}
},
"api_acladmin.updateResourceErrorResourceNotFound": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "No resource with ID 123"
},
"error": {
"type": "string",
"example": "RESOURCE_NOT_FOUND"
"example": "admin"
}
}
},
@@ -863,58 +700,6 @@ const docTemplate = `{
}
}
},
"api_acladmin.updateRoleErrorInvalidRoleID": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Role ID must be positive integer"
},
"error": {
"type": "string",
"example": "INVALID_ROLE_ID"
}
}
},
"api_acladmin.updateRoleErrorInvalidRoleName": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Invalid role name"
},
"error": {
"type": "string",
"example": "FAILED_TO_UPDATE_ROLE"
}
}
},
"api_acladmin.updateRoleErrorRoleNameAlreadyExists": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Role with name 'admin' already exists"
},
"error": {
"type": "string",
"example": "FAILED_TO_UPDATE_ROLE"
}
}
},
"api_acladmin.updateRoleErrorRoleNotFound": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "No role with ID 123"
},
"error": {
"type": "string",
"example": "ROLE_NOT_FOUND"
}
}
},
"api_acladmin.updateRoleRequest": {
"type": "object",
"properties": {

View File

@@ -19,15 +19,18 @@
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"key": {
"type": "string",
"example": "html.view"
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"key": {
"type": "string",
"example": "html.view"
}
}
}
}
@@ -36,7 +39,7 @@
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -73,19 +76,19 @@
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.createResourceErrorInvalidResourceKey"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.createResourceErrorResourceAlreadyExists"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -120,19 +123,19 @@
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.getResourceErrorInvalidResourceID"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.getResourceErrorResourceNotFound"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -162,25 +165,25 @@
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.deleteResourceErrorInvalidResourceID"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.deleteResourceErrorResourceNotFound"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.deleteResourceErrorResourceInUse"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -225,25 +228,25 @@
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.updateResourceErrorInvalidResourceKey"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.updateResourceErrorResourceNotFound"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.updateResourceErrorResourceKeyAlreadyExists"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -264,15 +267,18 @@
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"name": {
"type": "string",
"example": "admin"
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"name": {
"type": "string",
"example": "admin"
}
}
}
}
@@ -281,7 +287,7 @@
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -318,25 +324,19 @@
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInvalidRequestBody"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api_acladmin.createRoleErrorInvalidRoleName"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.createRoleErrorRoleAlreadyExists"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -371,19 +371,19 @@
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.getRoleErrorInvalidRoleID"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.getRoleErrorRoleNotFound"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -413,25 +413,25 @@
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.deleteRoleErrorInvalidRoleID"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.deleteRoleErrorRoleNotFound"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.deleteRoleErrorRoleInUse"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -476,25 +476,78 @@
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.updateRoleErrorInvalidRoleName"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.updateRoleErrorRoleNotFound"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.updateRoleErrorRoleNameAlreadyExists"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
}
},
"/api/acl/roles/{roleId}/users": {
"get": {
"produces": [
"application/json"
],
"tags": [
"roles"
],
"summary": "Get role users",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "Role ID",
"name": "roleId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/api_acladmin.getRoleUser"
}
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.ProblemDetails"
}
}
}
@@ -502,29 +555,28 @@
}
},
"definitions": {
"api_acladmin.createResourceErrorInvalidResourceKey": {
"api_acladmin.ProblemDetails": {
"type": "object",
"properties": {
"details": {
"detail": {
"type": "string",
"example": "Invalid resource key"
"example": "No role with ID 42"
},
"error": {
"instance": {
"type": "string",
"example": "FAILED_TO_CREATE_RESOURCE"
}
}
},
"api_acladmin.createResourceErrorResourceAlreadyExists": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Resource with key 'html.view' already exists"
"example": "/api/acl/roles/42"
},
"error": {
"status": {
"type": "integer",
"example": 404
},
"title": {
"type": "string",
"example": "FAILED_TO_CREATE_RESOURCE"
"example": "Role not found"
},
"type": {
"type": "string",
"example": "https://api.triggerssmith.com/errors/role-not-found"
}
}
},
@@ -550,32 +602,6 @@
}
}
},
"api_acladmin.createRoleErrorInvalidRoleName": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Invalid role name"
},
"error": {
"type": "string",
"example": "FAILED_TO_CREATE_ROLE"
}
}
},
"api_acladmin.createRoleErrorRoleAlreadyExists": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Role with name 'admin' already exists"
},
"error": {
"type": "string",
"example": "FAILED_TO_CREATE_ROLE"
}
}
},
"api_acladmin.createRoleRequest": {
"type": "object",
"properties": {
@@ -598,134 +624,6 @@
}
}
},
"api_acladmin.deleteResourceErrorInvalidResourceID": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Resource ID must be positive integer"
},
"error": {
"type": "string",
"example": "INVALID_RESOURCE_ID"
}
}
},
"api_acladmin.deleteResourceErrorResourceInUse": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Resource with ID 123 is used and cannot be deleted"
},
"error": {
"type": "string",
"example": "FAILED_TO_DELETE_RESOURCE"
}
}
},
"api_acladmin.deleteResourceErrorResourceNotFound": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "No resource with ID 123"
},
"error": {
"type": "string",
"example": "RESOURCE_NOT_FOUND"
}
}
},
"api_acladmin.deleteRoleErrorInvalidRoleID": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Role ID must be positive integer"
},
"error": {
"type": "string",
"example": "INVALID_ROLE_ID"
}
}
},
"api_acladmin.deleteRoleErrorRoleInUse": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Role with ID 123 is assigned to users and cannot be deleted"
},
"error": {
"type": "string",
"example": "FAILED_TO_DELETE_ROLE"
}
}
},
"api_acladmin.deleteRoleErrorRoleNotFound": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "No role with ID 123"
},
"error": {
"type": "string",
"example": "ROLE_NOT_FOUND"
}
}
},
"api_acladmin.errorInternalServerError": {
"type": "object",
"properties": {
"details": {
"type": "string"
},
"error": {
"type": "string"
}
}
},
"api_acladmin.errorInvalidRequestBody": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Request body is not valid JSON"
},
"error": {
"type": "string",
"example": "INVALID_REQUEST_BODY"
}
}
},
"api_acladmin.getResourceErrorInvalidResourceID": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Resource ID must be positive integer"
},
"error": {
"type": "string",
"example": "INVALID_RESOURCE_ID"
}
}
},
"api_acladmin.getResourceErrorResourceNotFound": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "No resource with ID 123"
},
"error": {
"type": "string",
"example": "RESOURCE_NOT_FOUND"
}
}
},
"api_acladmin.getResourceResponse": {
"type": "object",
"properties": {
@@ -739,32 +637,6 @@
}
}
},
"api_acladmin.getRoleErrorInvalidRoleID": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Role ID must be positive integer"
},
"error": {
"type": "string",
"example": "INVALID_ROLE_ID"
}
}
},
"api_acladmin.getRoleErrorRoleNotFound": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "No role with ID 123"
},
"error": {
"type": "string",
"example": "ROLE_NOT_FOUND"
}
}
},
"api_acladmin.getRoleResponse": {
"type": "object",
"properties": {
@@ -778,55 +650,20 @@
}
}
},
"api_acladmin.updateResourceErrorInvalidResourceID": {
"api_acladmin.getRoleUser": {
"type": "object",
"properties": {
"details": {
"userEmail": {
"type": "string",
"example": "Resource ID must be positive integer"
"example": "admin@triggerssmith.com"
},
"error": {
"type": "string",
"example": "INVALID_RESOURCE_ID"
}
}
},
"api_acladmin.updateResourceErrorInvalidResourceKey": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Invalid resource key"
"userId": {
"type": "integer",
"example": 1
},
"error": {
"userName": {
"type": "string",
"example": "FAILED_TO_UPDATE_RESOURCE"
}
}
},
"api_acladmin.updateResourceErrorResourceKeyAlreadyExists": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Resource with key 'html.view' already exists"
},
"error": {
"type": "string",
"example": "FAILED_TO_UPDATE_RESOURCE"
}
}
},
"api_acladmin.updateResourceErrorResourceNotFound": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "No resource with ID 123"
},
"error": {
"type": "string",
"example": "RESOURCE_NOT_FOUND"
"example": "admin"
}
}
},
@@ -852,58 +689,6 @@
}
}
},
"api_acladmin.updateRoleErrorInvalidRoleID": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Role ID must be positive integer"
},
"error": {
"type": "string",
"example": "INVALID_ROLE_ID"
}
}
},
"api_acladmin.updateRoleErrorInvalidRoleName": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Invalid role name"
},
"error": {
"type": "string",
"example": "FAILED_TO_UPDATE_ROLE"
}
}
},
"api_acladmin.updateRoleErrorRoleNameAlreadyExists": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Role with name 'admin' already exists"
},
"error": {
"type": "string",
"example": "FAILED_TO_UPDATE_ROLE"
}
}
},
"api_acladmin.updateRoleErrorRoleNotFound": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "No role with ID 123"
},
"error": {
"type": "string",
"example": "ROLE_NOT_FOUND"
}
}
},
"api_acladmin.updateRoleRequest": {
"type": "object",
"properties": {

View File

@@ -1,20 +1,20 @@
definitions:
api_acladmin.createResourceErrorInvalidResourceKey:
api_acladmin.ProblemDetails:
properties:
details:
example: Invalid resource key
detail:
example: No role with ID 42
type: string
error:
example: FAILED_TO_CREATE_RESOURCE
instance:
example: /api/acl/roles/42
type: string
type: object
api_acladmin.createResourceErrorResourceAlreadyExists:
properties:
details:
example: Resource with key 'html.view' already exists
status:
example: 404
type: integer
title:
example: Role not found
type: string
error:
example: FAILED_TO_CREATE_RESOURCE
type:
example: https://api.triggerssmith.com/errors/role-not-found
type: string
type: object
api_acladmin.createResourceRequest:
@@ -32,24 +32,6 @@ definitions:
example: html.view
type: string
type: object
api_acladmin.createRoleErrorInvalidRoleName:
properties:
details:
example: Invalid role name
type: string
error:
example: FAILED_TO_CREATE_ROLE
type: string
type: object
api_acladmin.createRoleErrorRoleAlreadyExists:
properties:
details:
example: Role with name 'admin' already exists
type: string
error:
example: FAILED_TO_CREATE_ROLE
type: string
type: object
api_acladmin.createRoleRequest:
properties:
name:
@@ -65,94 +47,6 @@ definitions:
example: admin
type: string
type: object
api_acladmin.deleteResourceErrorInvalidResourceID:
properties:
details:
example: Resource ID must be positive integer
type: string
error:
example: INVALID_RESOURCE_ID
type: string
type: object
api_acladmin.deleteResourceErrorResourceInUse:
properties:
details:
example: Resource with ID 123 is used and cannot be deleted
type: string
error:
example: FAILED_TO_DELETE_RESOURCE
type: string
type: object
api_acladmin.deleteResourceErrorResourceNotFound:
properties:
details:
example: No resource with ID 123
type: string
error:
example: RESOURCE_NOT_FOUND
type: string
type: object
api_acladmin.deleteRoleErrorInvalidRoleID:
properties:
details:
example: Role ID must be positive integer
type: string
error:
example: INVALID_ROLE_ID
type: string
type: object
api_acladmin.deleteRoleErrorRoleInUse:
properties:
details:
example: Role with ID 123 is assigned to users and cannot be deleted
type: string
error:
example: FAILED_TO_DELETE_ROLE
type: string
type: object
api_acladmin.deleteRoleErrorRoleNotFound:
properties:
details:
example: No role with ID 123
type: string
error:
example: ROLE_NOT_FOUND
type: string
type: object
api_acladmin.errorInternalServerError:
properties:
details:
type: string
error:
type: string
type: object
api_acladmin.errorInvalidRequestBody:
properties:
details:
example: Request body is not valid JSON
type: string
error:
example: INVALID_REQUEST_BODY
type: string
type: object
api_acladmin.getResourceErrorInvalidResourceID:
properties:
details:
example: Resource ID must be positive integer
type: string
error:
example: INVALID_RESOURCE_ID
type: string
type: object
api_acladmin.getResourceErrorResourceNotFound:
properties:
details:
example: No resource with ID 123
type: string
error:
example: RESOURCE_NOT_FOUND
type: string
type: object
api_acladmin.getResourceResponse:
properties:
id:
@@ -162,24 +56,6 @@ definitions:
example: html.view
type: string
type: object
api_acladmin.getRoleErrorInvalidRoleID:
properties:
details:
example: Role ID must be positive integer
type: string
error:
example: INVALID_ROLE_ID
type: string
type: object
api_acladmin.getRoleErrorRoleNotFound:
properties:
details:
example: No role with ID 123
type: string
error:
example: ROLE_NOT_FOUND
type: string
type: object
api_acladmin.getRoleResponse:
properties:
id:
@@ -189,40 +65,16 @@ definitions:
example: admin
type: string
type: object
api_acladmin.updateResourceErrorInvalidResourceID:
api_acladmin.getRoleUser:
properties:
details:
example: Resource ID must be positive integer
userEmail:
example: admin@triggerssmith.com
type: string
error:
example: INVALID_RESOURCE_ID
type: string
type: object
api_acladmin.updateResourceErrorInvalidResourceKey:
properties:
details:
example: Invalid resource key
type: string
error:
example: FAILED_TO_UPDATE_RESOURCE
type: string
type: object
api_acladmin.updateResourceErrorResourceKeyAlreadyExists:
properties:
details:
example: Resource with key 'html.view' already exists
type: string
error:
example: FAILED_TO_UPDATE_RESOURCE
type: string
type: object
api_acladmin.updateResourceErrorResourceNotFound:
properties:
details:
example: No resource with ID 123
type: string
error:
example: RESOURCE_NOT_FOUND
userId:
example: 1
type: integer
userName:
example: admin
type: string
type: object
api_acladmin.updateResourceRequest:
@@ -240,42 +92,6 @@ definitions:
example: html.view
type: string
type: object
api_acladmin.updateRoleErrorInvalidRoleID:
properties:
details:
example: Role ID must be positive integer
type: string
error:
example: INVALID_ROLE_ID
type: string
type: object
api_acladmin.updateRoleErrorInvalidRoleName:
properties:
details:
example: Invalid role name
type: string
error:
example: FAILED_TO_UPDATE_ROLE
type: string
type: object
api_acladmin.updateRoleErrorRoleNameAlreadyExists:
properties:
details:
example: Role with name 'admin' already exists
type: string
error:
example: FAILED_TO_UPDATE_ROLE
type: string
type: object
api_acladmin.updateRoleErrorRoleNotFound:
properties:
details:
example: No role with ID 123
type: string
error:
example: ROLE_NOT_FOUND
type: string
type: object
api_acladmin.updateRoleRequest:
properties:
name:
@@ -303,19 +119,21 @@ paths:
description: OK
schema:
items:
properties:
id:
example: 1
type: integer
key:
example: html.view
type: string
type: object
items:
properties:
id:
example: 1
type: integer
key:
example: html.view
type: string
type: object
type: array
type: array
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/api_acladmin.errorInternalServerError'
$ref: '#/definitions/api_acladmin.ProblemDetails'
summary: Get all resources
tags:
- resources
@@ -339,15 +157,15 @@ paths:
"400":
description: Bad Request
schema:
$ref: '#/definitions/api_acladmin.createResourceErrorInvalidResourceKey'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"409":
description: Conflict
schema:
$ref: '#/definitions/api_acladmin.createResourceErrorResourceAlreadyExists'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/api_acladmin.errorInternalServerError'
$ref: '#/definitions/api_acladmin.ProblemDetails'
summary: Create resource
tags:
- resources
@@ -368,19 +186,19 @@ paths:
"400":
description: Bad Request
schema:
$ref: '#/definitions/api_acladmin.deleteResourceErrorInvalidResourceID'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"404":
description: Not Found
schema:
$ref: '#/definitions/api_acladmin.deleteResourceErrorResourceNotFound'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"409":
description: Conflict
schema:
$ref: '#/definitions/api_acladmin.deleteResourceErrorResourceInUse'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/api_acladmin.errorInternalServerError'
$ref: '#/definitions/api_acladmin.ProblemDetails'
summary: Delete resource
tags:
- resources
@@ -402,15 +220,15 @@ paths:
"400":
description: Bad Request
schema:
$ref: '#/definitions/api_acladmin.getResourceErrorInvalidResourceID'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"404":
description: Not Found
schema:
$ref: '#/definitions/api_acladmin.getResourceErrorResourceNotFound'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/api_acladmin.errorInternalServerError'
$ref: '#/definitions/api_acladmin.ProblemDetails'
summary: Get resource by ID
tags:
- resources
@@ -440,19 +258,19 @@ paths:
"400":
description: Bad Request
schema:
$ref: '#/definitions/api_acladmin.updateResourceErrorInvalidResourceKey'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"404":
description: Not Found
schema:
$ref: '#/definitions/api_acladmin.updateResourceErrorResourceNotFound'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"409":
description: Conflict
schema:
$ref: '#/definitions/api_acladmin.updateResourceErrorResourceKeyAlreadyExists'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/api_acladmin.errorInternalServerError'
$ref: '#/definitions/api_acladmin.ProblemDetails'
summary: Update resource
tags:
- resources
@@ -465,19 +283,21 @@ paths:
description: OK
schema:
items:
properties:
id:
example: 1
type: integer
name:
example: admin
type: string
type: object
items:
properties:
id:
example: 1
type: integer
name:
example: admin
type: string
type: object
type: array
type: array
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/api_acladmin.errorInternalServerError'
$ref: '#/definitions/api_acladmin.ProblemDetails'
summary: Get all roles
tags:
- roles
@@ -501,19 +321,15 @@ paths:
"400":
description: Bad Request
schema:
$ref: '#/definitions/api_acladmin.errorInvalidRequestBody'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/api_acladmin.createRoleErrorInvalidRoleName'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"409":
description: Conflict
schema:
$ref: '#/definitions/api_acladmin.createRoleErrorRoleAlreadyExists'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/api_acladmin.errorInternalServerError'
$ref: '#/definitions/api_acladmin.ProblemDetails'
summary: Create role
tags:
- roles
@@ -534,19 +350,19 @@ paths:
"400":
description: Bad Request
schema:
$ref: '#/definitions/api_acladmin.deleteRoleErrorInvalidRoleID'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"404":
description: Not Found
schema:
$ref: '#/definitions/api_acladmin.deleteRoleErrorRoleNotFound'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"409":
description: Conflict
schema:
$ref: '#/definitions/api_acladmin.deleteRoleErrorRoleInUse'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/api_acladmin.errorInternalServerError'
$ref: '#/definitions/api_acladmin.ProblemDetails'
summary: Delete role
tags:
- roles
@@ -568,15 +384,15 @@ paths:
"400":
description: Bad Request
schema:
$ref: '#/definitions/api_acladmin.getRoleErrorInvalidRoleID'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"404":
description: Not Found
schema:
$ref: '#/definitions/api_acladmin.getRoleErrorRoleNotFound'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/api_acladmin.errorInternalServerError'
$ref: '#/definitions/api_acladmin.ProblemDetails'
summary: Get role by ID
tags:
- roles
@@ -606,20 +422,55 @@ paths:
"400":
description: Bad Request
schema:
$ref: '#/definitions/api_acladmin.updateRoleErrorInvalidRoleName'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"404":
description: Not Found
schema:
$ref: '#/definitions/api_acladmin.updateRoleErrorRoleNotFound'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"409":
description: Conflict
schema:
$ref: '#/definitions/api_acladmin.updateRoleErrorRoleNameAlreadyExists'
$ref: '#/definitions/api_acladmin.ProblemDetails'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/api_acladmin.errorInternalServerError'
$ref: '#/definitions/api_acladmin.ProblemDetails'
summary: Update role
tags:
- roles
/api/acl/roles/{roleId}/users:
get:
parameters:
- description: Role ID
example: 1
in: path
name: roleId
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
items:
$ref: '#/definitions/api_acladmin.getRoleUser'
type: array
type: array
"400":
description: Bad Request
schema:
$ref: '#/definitions/api_acladmin.ProblemDetails'
"404":
description: Not Found
schema:
$ref: '#/definitions/api_acladmin.ProblemDetails'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/api_acladmin.ProblemDetails'
summary: Get role users
tags:
- roles
swagger: "2.0"