{ "swagger": "2.0", "info": { "contact": {} }, "paths": { "/api/acl/resources": { "get": { "produces": [ "application/json" ], "tags": [ "acl/resources" ], "summary": "Get all resources", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "example": 1 }, "key": { "type": "string", "example": "html.view" } } } } } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } } } }, "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "acl/resources" ], "summary": "Create resource", "parameters": [ { "description": "Resource", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/api_acladmin.createResourceRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/api_acladmin.createResourceResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } } } } }, "/api/acl/resources/{resourceId}": { "get": { "produces": [ "application/json" ], "tags": [ "acl/resources" ], "summary": "Get resource by ID", "parameters": [ { "type": "integer", "example": 1, "description": "Resource ID", "name": "resourceId", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/api_acladmin.getResourceResponse" } }, "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" } } } }, "delete": { "produces": [ "application/json" ], "tags": [ "acl/resources" ], "summary": "Delete resource", "parameters": [ { "type": "integer", "example": 1, "description": "Resource ID", "name": "resourceId", "in": "path", "required": true } ], "responses": { "200": { "description": "OK" }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } } } }, "patch": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "acl/resources" ], "summary": "Update resource", "parameters": [ { "type": "integer", "example": 1, "description": "Resource ID", "name": "resourceId", "in": "path", "required": true }, { "description": "Resource", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/api_acladmin.updateResourceRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/api_acladmin.updateResourceResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } } } } }, "/api/acl/roles": { "get": { "produces": [ "application/json" ], "tags": [ "acl/roles" ], "summary": "Get all roles", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "example": 1 }, "name": { "type": "string", "example": "admin" } } } } } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } } } }, "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "acl/roles" ], "summary": "Create role", "parameters": [ { "description": "Role", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/api_acladmin.createRoleRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/api_acladmin.createRoleResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } } } } }, "/api/acl/roles/{roleId}": { "get": { "produces": [ "application/json" ], "tags": [ "acl/roles" ], "summary": "Get role by ID", "parameters": [ { "type": "integer", "example": 1, "description": "Role ID", "name": "roleId", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/api_acladmin.getRoleResponse" } }, "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" } } } }, "delete": { "produces": [ "application/json" ], "tags": [ "acl/roles" ], "summary": "Delete role", "parameters": [ { "type": "integer", "example": 1, "description": "Role ID", "name": "roleId", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } } } }, "patch": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "acl/roles" ], "summary": "Update role", "parameters": [ { "type": "integer", "example": 1, "description": "Role ID", "name": "roleId", "in": "path", "required": true }, { "description": "Role", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/api_acladmin.updateRoleRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/api_acladmin.updateRoleResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } } } } }, "/api/acl/roles/{roleId}/resources": { "get": { "produces": [ "application/json" ], "tags": [ "acl/roles" ], "summary": "Get role resources", "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.getRoleResource" } } } }, "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" } } } }, "post": { "produces": [ "application/json" ], "tags": [ "acl/roles" ], "summary": "Assign resource to role", "parameters": [ { "type": "integer", "example": 1, "description": "Role ID", "name": "roleId", "in": "path", "required": true }, { "description": "Resource", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/api_acladmin.assignResourceToRoleRequest" } } ], "responses": { "201": { "description": "Created" }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } } } } }, "/api/acl/roles/{roleId}/resources/{resId}": { "delete": { "produces": [ "application/json" ], "tags": [ "acl/roles" ], "summary": "Remove resource from role", "parameters": [ { "type": "integer", "example": 1, "description": "Role ID", "name": "roleId", "in": "path", "required": true }, { "type": "integer", "example": 1, "description": "Resource ID", "name": "resId", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "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" } } } } }, "/api/acl/roles/{roleId}/users": { "get": { "produces": [ "application/json" ], "tags": [ "acl/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" } } } } }, "/api/acl/users/{userId}/roles": { "get": { "produces": [ "application/json" ], "tags": [ "acl/users" ], "summary": "Get user roles by user ID", "parameters": [ { "type": "integer", "example": 1, "description": "User ID", "name": "userId", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/api_acladmin.getUserRole" } } }, "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" } } } }, "post": { "produces": [ "application/json" ], "tags": [ "acl/users" ], "summary": "Assign role to user", "parameters": [ { "type": "integer", "example": 1, "description": "User ID", "name": "userId", "in": "path", "required": true }, { "description": "Role ID", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/api_acladmin.assignRoleToUserRequest" } } ], "responses": { "201": { "description": "Created" }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/api_acladmin.ProblemDetails" } } } } }, "/api/acl/users/{userId}/roles/{roleId}": { "delete": { "produces": [ "application/json" ], "tags": [ "acl/users" ], "summary": "Remove role from user", "parameters": [ { "type": "integer", "example": 1, "description": "User ID", "name": "userId", "in": "path", "required": true }, { "type": "integer", "example": 1, "description": "Role ID", "name": "roleId", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "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" } } } } } }, "definitions": { "api_acladmin.ProblemDetails": { "type": "object", "properties": { "detail": { "type": "string", "example": "No role with ID 42" }, "instance": { "type": "string", "example": "/api/acl/roles/42" }, "status": { "type": "integer", "example": 404 }, "title": { "type": "string", "example": "Role not found" }, "type": { "type": "string", "example": "https://api.triggerssmith.com/errors/role-not-found" } } }, "api_acladmin.assignResourceToRoleRequest": { "type": "object", "properties": { "resourceId": { "type": "integer", "example": 1 } } }, "api_acladmin.assignRoleToUserRequest": { "type": "object", "properties": { "roleId": { "type": "integer", "example": 1 } } }, "api_acladmin.createResourceRequest": { "type": "object", "properties": { "key": { "type": "string", "example": "html.view" } } }, "api_acladmin.createResourceResponse": { "type": "object", "properties": { "id": { "type": "integer", "example": 1 }, "key": { "type": "string", "example": "html.view" } } }, "api_acladmin.createRoleRequest": { "type": "object", "properties": { "name": { "type": "string", "example": "admin" } } }, "api_acladmin.createRoleResponse": { "type": "object", "properties": { "id": { "type": "integer", "example": 1 }, "name": { "type": "string", "example": "admin" } } }, "api_acladmin.getResourceResponse": { "type": "object", "properties": { "id": { "type": "integer", "example": 1 }, "key": { "type": "string", "example": "html.view" } } }, "api_acladmin.getRoleResource": { "type": "object", "properties": { "id": { "type": "integer", "example": 1 }, "name": { "type": "string", "example": "*" } } }, "api_acladmin.getRoleResponse": { "type": "object", "properties": { "id": { "type": "integer", "example": 1 }, "name": { "type": "string", "example": "admin" } } }, "api_acladmin.getRoleUser": { "type": "object", "properties": { "email": { "type": "string", "example": "admin@triggerssmith.com" }, "id": { "type": "integer", "example": 1 }, "username": { "type": "string", "example": "admin" } } }, "api_acladmin.getUserRole": { "type": "object", "properties": { "id": { "type": "integer", "example": 1 }, "name": { "type": "string", "example": "*" } } }, "api_acladmin.updateResourceRequest": { "type": "object", "properties": { "key": { "type": "string", "example": "html.view" } } }, "api_acladmin.updateResourceResponse": { "type": "object", "properties": { "id": { "type": "integer", "example": 1 }, "key": { "type": "string", "example": "html.view" } } }, "api_acladmin.updateRoleRequest": { "type": "object", "properties": { "name": { "type": "string", "example": "admin" } } }, "api_acladmin.updateRoleResponse": { "type": "object", "properties": { "id": { "type": "integer", "example": 1 }, "name": { "type": "string", "example": "admin" } } } } }