Files
contracts/proto/admin/admin-account.proto
Дмитрий 284059d19d
All checks were successful
Publish / Publish Job (push) Successful in 2m26s
add admin methods
2026-04-11 21:10:41 +03:00

159 lines
3.8 KiB
Protocol Buffer
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
syntax = "proto3";
package admin.v1;
option go_package = "git.lendry.ru/lendry-erp/proto.git/go;pb";
// Единый сервис для всех административных операций
service AdminService {
// Управление учетными записями
rpc CreateUser(CreateUserRequest) returns (CreateUserResponse);
rpc DeleteUser(DeleteUserRequest) returns (DeleteUserResponse);
rpc BlockUser(BlockUserRequest) returns (BlockUserResponse);
rpc UnblockUser(UnblockUserRequest) returns (UnblockUserResponse);
// Управление данными и безопасностью
rpc ChangeData(ChangeDataRequest) returns (ChangeDataResponse);
rpc AdminResetPassword (AdminResetPasswordRequest) returns (AdminResetPasswordResponse);
// Управление ролями (RBAC)
rpc AssignRole (AssignRoleRequest) returns (AssignRoleResponse);
rpc RevokeRole (RevokeRoleRequest) returns (RevokeRoleResponse);
// Управление черным списком IP
rpc BlockIp(BlockIpRequest) returns (BlockIpResponse);
rpc UnblockIp(UnblockIpRequest) returns (UnblockIpResponse);
// Синхронизация с поисковым движком (Elasticsearch)
rpc SyncUsersToSearch (SyncUsersToSearchRequest) returns (SyncUsersToSearchResponse);
}
// --- DTO для управления учетными записями ---
message CreateUserRequest {
string username = 1;
string password = 2;
repeated string roles = 3;
}
message CreateUserResponse {
bool success = 1;
string message = 2;
}
message DeleteUserRequest {
string user_id = 1;
}
message DeleteUserResponse {
bool success = 1;
string message = 2;
}
message BlockUserRequest {
string user_id = 1; // Кого блокируем
string admin_id = 2; // Кто блокирует
optional string reason = 3;
}
message BlockUserResponse {
bool success = 1;
string message = 2;
}
message UnblockUserRequest {
string user_id = 1;
string admin_id = 2;
}
message UnblockUserResponse {
bool success = 1;
string message = 2;
}
// --- DTO для управления данными и безопасностью ---
message ChangeDataRequest {
string user_id = 1;
string session_id = 2;
optional string email = 3;
optional string phone = 4;
optional string full_name = 5;
optional string avatar_url = 6;
optional string custom_status_text = 7;
optional string custom_status_emoji = 8;
optional string timezone = 9;
optional string language = 10;
optional bool is_public = 11;
}
message ChangeDataResponse {
bool success = 1;
string message = 2;
}
message AdminResetPasswordRequest {
string user_id = 1;
string new_password = 2;
}
message AdminResetPasswordResponse {
bool success = 1;
string message = 2;
}
// --- DTO для управления ролями (RBAC) ---
message AssignRoleRequest {
string user_id = 1;
string role_id = 2; // Передаем как string, внутри парсим в Int
}
message AssignRoleResponse {
bool success = 1;
string message = 2;
}
message RevokeRoleRequest {
string user_id = 1;
string role_id = 2;
}
message RevokeRoleResponse {
bool success = 1;
string message = 2;
}
// --- DTO для управления черным списком IP ---
message BlockIpRequest {
string ip_address = 1;
string admin_id = 2;
optional string reason = 3;
}
message BlockIpResponse {
bool success = 1;
string message = 2;
}
message UnblockIpRequest {
string ip_address = 1;
string admin_id = 2;
}
message UnblockIpResponse {
bool success = 1;
string message = 2;
}
// --- DTO для синхронизации с поиском ---
message SyncUsersToSearchRequest {
// Пустой запрос, так как параметры не требуются
}
message SyncUsersToSearchResponse {
bool success = 1;
string message = 2;
}