{ "swagger": "2.0", "info": { "description": "сервис управления администраторами", "title": "msp-admin-service", "contact": {}, "license": { "name": "GNU GPL v3.0" }, "version": "1.0.0" }, "host": "localhost:9000", "basePath": "/api/admin", "paths": { "/auth/login": { "post": { "description": "Авторизация с получением токена администратора", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Авторизация по логину и паролю", "parameters": [ { "description": "Тело запроса", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/domain.LoginRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.LoginResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "401": { "description": "Данные для авторизации не верны", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/auth/login_with_sudir": { "post": { "description": "Авторизация с получением токена администратора", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Авторизация по авторизационному коду от СУДИР", "parameters": [ { "description": "Тело запроса", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/domain.LoginSudirRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.LoginResponse" } }, "401": { "description": "Некорректный код для авторизации", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "412": { "description": "Авторизация СУДИР не настроена на сервере", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/auth/logout": { "post": { "description": "Выход из авторизованной сессии администрирования", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Выход из авторизованной сессии", "parameters": [ { "type": "string", "description": "Токен администратора", "name": "X-AUTH-ADMIN", "in": "header", "required": true } ], "responses": { "200": { "description": "OK" }, "400": { "description": "Невалидный токен", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/log/all": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "log" ], "summary": "Получение списка логов", "parameters": [ { "type": "string", "description": "Токен администратора", "name": "X-AUTH-ADMIN", "in": "header", "required": true }, { "description": "Тело запроса", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/domain.PageRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.AuditResponse" } }, "400": { "description": "Невалидное тело запроса", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/log/events": { "post": { "description": "Возвращает полный список доступных событий аудита", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "log" ], "summary": "Получение списка логов", "parameters": [ { "type": "string", "description": "Токен администратора", "name": "X-AUTH-ADMIN", "in": "header", "required": true }, { "description": "Тело запроса", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/domain.AuditResponse" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.AuditEvent" } } }, "400": { "description": "Невалидное тело запроса", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/log/set_events": { "post": { "description": "Всегда возвращает полный список доступных событий аудита", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "log" ], "summary": "Получение списка логов", "parameters": [ { "type": "string", "description": "Токен администратора", "name": "X-AUTH-ADMIN", "in": "header", "required": true }, { "description": "Тело запроса", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/domain.SetAuditEvent" } } ], "responses": { "200": { "description": "OK" }, "400": { "description": "Невалидное тело запроса", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/role/all": { "post": { "description": "Получить список ролей", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "role" ], "summary": "Список ролей", "parameters": [ { "type": "string", "description": "Токен администратора", "name": "X-AUTH-ADMIN", "in": "header", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Role" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/role/create": { "post": { "description": "Создать роль", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Создать роль", "parameters": [ { "type": "string", "description": "Токен администратора", "name": "X-AUTH-ADMIN", "in": "header", "required": true }, { "description": "Тело запроса", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/domain.CreateRoleRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.User" } }, "400": { "description": "Невалидное тело запроса", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "409": { "description": "Роль с указанным именем уже существует", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/role/delete": { "post": { "description": "Удалить существующую роль", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "role" ], "summary": "Удалить роль", "parameters": [ { "type": "string", "description": "Токен администратора", "name": "X-AUTH-ADMIN", "in": "header", "required": true }, { "description": "Тело запроса", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/domain.DeleteRoleRequest" } } ], "responses": { "200": { "description": "OK" }, "400": { "description": "Невалидное тело запроса", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/role/update": { "post": { "description": "Обновить данные существующую роль", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "role" ], "summary": "Обновить роль", "parameters": [ { "type": "string", "description": "Токен администратора", "name": "X-AUTH-ADMIN", "in": "header", "required": true }, { "description": "Тело запроса", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/domain.UpdateRoleRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.Role" } }, "404": { "description": "Роль с указанным id не существует", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "409": { "description": "Роль с указанным именем уже существует", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/secure/authenticate": { "post": { "description": "Проверяет токен и возвращает идентификатор администратора", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "secure" ], "summary": "Метод аутентификации токена", "parameters": [ { "description": "Тело запроса", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/domain.SecureAuthRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.SecureAuthResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/secure/authorize": { "post": { "description": "Проверяет наличие у администратора необходимого разрешения", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "secure" ], "summary": "Метод авторизации для администратора", "parameters": [ { "description": "Тело запроса", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/domain.SecureAuthzRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.SecureAuthzResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/session/all": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "session" ], "summary": "Получение списка сессий", "parameters": [ { "type": "string", "description": "Токен администратора", "name": "X-AUTH-ADMIN", "in": "header", "required": true }, { "description": "Тело запроса", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/domain.SessionRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.PageRequest" } }, "400": { "description": "Невалидное тело запроса", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/session/revoke": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "session" ], "summary": "Отзыв сессии", "parameters": [ { "type": "string", "description": "Токен администратора", "name": "X-AUTH-ADMIN", "in": "header", "required": true }, { "description": "Тело запроса", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/domain.RevokeRequest" } } ], "responses": { "200": { "description": "OK" }, "400": { "description": "Невалидное тело запроса", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/user/block_user": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Метод блокировки/разблокировки пользователя", "parameters": [ { "type": "string", "description": "Токен администратора", "name": "X-AUTH-ADMIN", "in": "header", "required": true }, { "description": "Тело запроса", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/domain.IdRequest" } } ], "responses": { "200": { "description": "OK" }, "400": { "description": "Невалидное тело запроса", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/user/change_password": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Метод изменения пароля пользователя", "parameters": [ { "type": "string", "description": "Токен администратора", "name": "X-AUTH-ADMIN", "in": "header", "required": true }, { "description": "Тело запроса", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/domain.ChangePasswordRequest" } } ], "responses": { "200": { "description": "OK" }, "400": { "description": "Невалидное тело запроса", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/user/create_user": { "post": { "description": "Создать пользователя", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Создать пользователя", "parameters": [ { "type": "string", "description": "Токен администратора", "name": "X-AUTH-ADMIN", "in": "header", "required": true }, { "description": "Тело запроса", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/domain.CreateUserRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.User" } }, "400": { "description": "Невалидное тело запроса", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "409": { "description": "Пользователь с указанным email уже существует", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/user/delete_user": { "post": { "description": "Удалить существующего пользователя", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Удалить пользователя", "parameters": [ { "type": "string", "description": "Токен администратора", "name": "X-AUTH-ADMIN", "in": "header", "required": true }, { "description": "Тело запроса", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/domain.IdentitiesRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.DeleteResponse" } }, "400": { "description": "Невалидное тело запроса", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/user/get_by_id": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Метод получения данных по пользователю", "parameters": [ { "description": "Тело запроса", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/domain.IdRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.User" } }, "400": { "description": "Невалидное тело запроса", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/user/get_design": { "post": { "description": "Получение внешнего вида (палитра и наименование) админ-интерфейса", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Получение внешнего вида", "parameters": [ { "type": "string", "description": "Токен администратора", "name": "X-AUTH-ADMIN", "in": "header", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/conf.UIDesign" } }, "400": { "description": "Невалидный токен", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/user/get_profile": { "post": { "description": "Получить данные профиля", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Получить профиль", "parameters": [ { "type": "string", "description": "Токен администратора", "name": "X-AUTH-ADMIN", "in": "header", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.AdminUserShort" } }, "400": { "description": "Невалидный токен", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "404": { "description": "Пользователя не существует", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/user/get_users": { "post": { "description": "Получить список пользователей", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Список пользователей", "parameters": [ { "type": "string", "description": "Токен администратора", "name": "X-AUTH-ADMIN", "in": "header", "required": true }, { "description": "Тело запроса", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/domain.UsersRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.UsersResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } }, "/user/update_user": { "post": { "description": "Обновить данные существующего пользователя", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Обновить пользователя", "parameters": [ { "type": "string", "description": "Токен администратора", "name": "X-AUTH-ADMIN", "in": "header", "required": true }, { "description": "Тело запроса", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/domain.UpdateUserRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.User" } }, "400": { "description": "Невалидное тело запроса", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "404": { "description": "Пользователь с указанным id не существует", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "409": { "description": "Пользователь с указанным email уже существует", "schema": { "$ref": "#/definitions/domain.GrpcError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/domain.GrpcError" } } } } } }, "definitions": { "conf.UIDesign": { "type": "object", "properties": { "name": { "type": "string" }, "primaryColor": { "type": "string" } } }, "domain.AdminUserShort": { "type": "object", "properties": { "email": { "type": "string" }, "firstName": { "type": "string" }, "idleTimeoutMs": { "type": "integer" }, "lastName": { "type": "string" }, "permissions": { "type": "array", "items": { "type": "string" } }, "role": { "type": "string" }, "roles": { "type": "array", "items": { "type": "integer" } } } }, "domain.Audit": { "type": "object", "properties": { "createdAt": { "type": "string" }, "id": { "type": "integer" }, "message": { "type": "string" }, "userId": { "type": "integer" } } }, "domain.AuditEvent": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "event": { "type": "string" }, "name": { "type": "string" } } }, "domain.AuditResponse": { "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/definitions/domain.Audit" } }, "totalCount": { "type": "integer" } } }, "domain.ChangePasswordRequest": { "type": "object", "properties": { "newPassword": { "type": "string" }, "oldPassword": { "type": "string" } } }, "domain.CreateRoleRequest": { "type": "object", "properties": { "changeMessage": { "type": "string" }, "externalGroup": { "type": "string" }, "name": { "type": "string" }, "permissions": { "type": "array", "items": { "type": "string" } } } }, "domain.CreateUserRequest": { "type": "object", "properties": { "description": { "type": "string" }, "email": { "type": "string" }, "firstName": { "type": "string" }, "lastName": { "type": "string" }, "password": { "type": "string" }, "roles": { "type": "array", "items": { "type": "integer" } } } }, "domain.DeleteResponse": { "type": "object", "properties": { "deleted": { "type": "integer" } } }, "domain.DeleteRoleRequest": { "type": "object", "properties": { "id": { "type": "integer" } } }, "domain.GrpcError": { "type": "object", "properties": { "details": { "type": "array", "items": {} }, "errorCode": { "type": "string" }, "errorMessage": { "type": "string" } } }, "domain.IdRequest": { "type": "object", "properties": { "userId": { "type": "integer" } } }, "domain.IdentitiesRequest": { "type": "object", "properties": { "ids": { "type": "array", "items": { "type": "integer" } } } }, "domain.LoginRequest": { "type": "object", "properties": { "email": { "type": "string" }, "password": { "type": "string" } } }, "domain.LoginResponse": { "type": "object", "properties": { "expired": { "type": "string" }, "headerName": { "type": "string" }, "token": { "type": "string" } } }, "domain.LoginSudirRequest": { "type": "object", "properties": { "authCode": { "type": "string" } } }, "domain.PageRequest": { "type": "object", "properties": { "limit": { "type": "integer" }, "offset": { "type": "integer" } } }, "domain.Permission": { "type": "object", "properties": { "key": { "type": "string" }, "name": { "type": "string" } } }, "domain.RevokeRequest": { "type": "object", "properties": { "id": { "type": "integer" } } }, "domain.Role": { "type": "object", "properties": { "changeMessage": { "type": "string" }, "createdAt": { "type": "string" }, "exclusive": { "type": "boolean" }, "externalGroup": { "type": "string" }, "id": { "type": "integer" }, "immutable": { "type": "boolean" }, "name": { "type": "string" }, "permissions": { "type": "array", "items": { "type": "string" } }, "updatedAt": { "type": "string" } } }, "domain.SecureAuthRequest": { "type": "object", "properties": { "token": { "type": "string" } } }, "domain.SecureAuthResponse": { "type": "object", "properties": { "adminId": { "type": "integer" }, "authenticated": { "type": "boolean" }, "errorReason": { "type": "string" } } }, "domain.SecureAuthzRequest": { "type": "object", "properties": { "adminId": { "type": "integer" }, "permission": { "type": "string" } } }, "domain.SecureAuthzResponse": { "type": "object", "properties": { "authorized": { "type": "boolean" } } }, "domain.SessionRequest": { "type": "object", "properties": { "limit": { "type": "integer" }, "offset": { "type": "integer" } } }, "domain.SetAuditEvent": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "event": { "type": "string" } } }, "domain.UpdateRoleRequest": { "type": "object", "properties": { "changeMessage": { "type": "string" }, "externalGroup": { "type": "string" }, "id": { "type": "integer" }, "name": { "type": "string" }, "permissions": { "type": "array", "items": { "type": "string" } } } }, "domain.UpdateUserRequest": { "type": "object", "properties": { "blocked": { "type": "boolean" }, "description": { "type": "string" }, "email": { "type": "string" }, "firstName": { "type": "string" }, "id": { "type": "integer" }, "lastName": { "type": "string" }, "roles": { "type": "array", "items": { "type": "integer" } } } }, "domain.User": { "type": "object", "properties": { "blocked": { "type": "boolean" }, "createdAt": { "type": "string" }, "description": { "type": "string" }, "email": { "type": "string" }, "firstName": { "type": "string" }, "id": { "type": "integer" }, "lastName": { "type": "string" }, "lastSessionCreatedAt": { "type": "string" }, "roles": { "type": "array", "items": { "type": "integer" } }, "updatedAt": { "type": "string" } } }, "domain.UsersRequest": { "type": "object", "properties": { "email": { "type": "string" }, "ids": { "type": "array", "items": { "type": "integer" } }, "limit": { "type": "integer" }, "offset": { "type": "integer" } } }, "domain.UsersResponse": { "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/definitions/domain.User" } } } } } }