This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@lendry-erp/contracts",
|
"name": "@lendry-erp/contracts",
|
||||||
"version": "1.1.10",
|
"version": "1.2.10",
|
||||||
"description": "Protobuf definitions and generated TypeScript types",
|
"description": "Protobuf definitions and generated TypeScript types",
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
|
|||||||
122
proto/admin/admin-account.proto
Normal file
122
proto/admin/admin-account.proto
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package admin.account.v1;
|
||||||
|
|
||||||
|
option go_package = "git.lendry.ru/lendry-erp/proto.git/go;pb";
|
||||||
|
|
||||||
|
service AdminAccountService {
|
||||||
|
rpc AdminResetPassword (AdminResetPasswordRequest) returns (AdminResetPasswordResponse);
|
||||||
|
rpc CreateUser(CreateUserRequest) returns (CreateUserResponse);
|
||||||
|
rpc DeleteUser(DeleteUserRequest) returns (DeleteUserResponse);
|
||||||
|
rpc ChangeData(ChangeDataRequest) returns (ChangeDataResponse);
|
||||||
|
rpc AssignRole (AssignRoleRequest) returns (AssignRoleResponse);
|
||||||
|
rpc RevokeRole (RevokeRoleRequest) returns (RevokeRoleResponse);
|
||||||
|
|
||||||
|
rpc BlockUser(BlockUserRequest) returns (BlockUserResponse);
|
||||||
|
rpc UnblockUser(UnblockUserRequest) returns (UnblockUserResponse);
|
||||||
|
rpc BlockIp(BlockIpRequest) returns (BlockIpResponse);
|
||||||
|
rpc UnblockIp(UnblockIpRequest) returns (UnblockIpResponse);
|
||||||
|
|
||||||
|
rpc SyncUsersToSearch (SyncUsersToSearchRequest) returns (SyncUsersToSearchResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
message AdminResetPasswordRequest {
|
||||||
|
string user_id = 1;
|
||||||
|
string new_password = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AdminResetPasswordResponse {
|
||||||
|
bool success = 1;
|
||||||
|
string message = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 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 AssignRoleRequest {
|
||||||
|
string user_id = 1;
|
||||||
|
string role_id = 2; // В gRPC передаем как 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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; }
|
||||||
|
|
||||||
|
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; }
|
||||||
|
|
||||||
|
message SyncUsersToSearchRequest {
|
||||||
|
// Можно оставить пустым, так как нам не нужны входные данные
|
||||||
|
}
|
||||||
|
|
||||||
|
message SyncUsersToSearchResponse {
|
||||||
|
bool success = 1;
|
||||||
|
string message = 2;
|
||||||
|
}
|
||||||
@@ -7,23 +7,10 @@ option go_package = "git.lendry.ru/lendry-erp/proto.git/go;pb";
|
|||||||
service AccountService {
|
service AccountService {
|
||||||
rpc GetAccount(GetAccountRequest) returns (GetAccountResponse);
|
rpc GetAccount(GetAccountRequest) returns (GetAccountResponse);
|
||||||
rpc ChangePassword (ChangePasswordRequest) returns (ChangePasswordResponse);
|
rpc ChangePassword (ChangePasswordRequest) returns (ChangePasswordResponse);
|
||||||
rpc AdminResetPassword (AdminResetPasswordRequest) returns (AdminResetPasswordResponse);
|
|
||||||
rpc CreateUser(CreateUserRequest) returns (CreateUserResponse);
|
|
||||||
rpc DeleteUser(DeleteUserRequest) returns (DeleteUserResponse);
|
|
||||||
rpc ChangeData(ChangeDataRequest) returns (ChangeDataResponse);
|
|
||||||
rpc AssignRole (AssignRoleRequest) returns (AssignRoleResponse);
|
|
||||||
rpc RevokeRole (RevokeRoleRequest) returns (RevokeRoleResponse);
|
|
||||||
rpc SetPin (SetPinRequest) returns (SetPinResponse);
|
rpc SetPin (SetPinRequest) returns (SetPinResponse);
|
||||||
rpc UnlockPin (UnlockPinRequest) returns (UnlockPinResponse);
|
rpc UnlockPin (UnlockPinRequest) returns (UnlockPinResponse);
|
||||||
rpc GetPinStatus (GetPinStatusRequest) returns (GetPinStatusResponse);
|
rpc GetPinStatus (GetPinStatusRequest) returns (GetPinStatusResponse);
|
||||||
rpc RemovePin (RemovePinRequest) returns (RemovePinResponse);
|
rpc RemovePin (RemovePinRequest) returns (RemovePinResponse);
|
||||||
|
|
||||||
rpc BlockUser(BlockUserRequest) returns (BlockUserResponse);
|
|
||||||
rpc UnblockUser(UnblockUserRequest) returns (UnblockUserResponse);
|
|
||||||
rpc BlockIp(BlockIpRequest) returns (BlockIpResponse);
|
|
||||||
rpc UnblockIp(UnblockIpRequest) returns (UnblockIpResponse);
|
|
||||||
|
|
||||||
rpc SyncUsersToSearch (SyncUsersToSearchRequest) returns (SyncUsersToSearchResponse);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetAccountRequest {
|
message GetAccountRequest {
|
||||||
@@ -64,71 +51,6 @@ message ChangePasswordResponse {
|
|||||||
string message = 2;
|
string message = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 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 AssignRoleRequest {
|
|
||||||
string user_id = 1;
|
|
||||||
string role_id = 2; // В gRPC передаем как 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
message AdminResetPasswordRequest {
|
|
||||||
string user_id = 1;
|
|
||||||
string new_password = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message AdminResetPasswordResponse {
|
|
||||||
bool success = 1;
|
|
||||||
string message = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SetPinRequest {
|
message SetPinRequest {
|
||||||
string user_id = 1;
|
string user_id = 1;
|
||||||
@@ -174,37 +96,3 @@ message RemovePinResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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; }
|
|
||||||
|
|
||||||
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; }
|
|
||||||
|
|
||||||
message SyncUsersToSearchRequest {
|
|
||||||
// Можно оставить пустым, так как нам не нужны входные данные
|
|
||||||
}
|
|
||||||
|
|
||||||
message SyncUsersToSearchResponse {
|
|
||||||
bool success = 1;
|
|
||||||
string message = 2;
|
|
||||||
}
|
|
||||||
60
proto/users/users.proto
Normal file
60
proto/users/users.proto
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package users.v1;
|
||||||
|
|
||||||
|
option go_package = "git.lendry.ru/lendry-erp/proto.git/go;pb";
|
||||||
|
|
||||||
|
service UsersService {
|
||||||
|
rpc GetMe(GetMeRequest) returns (GetMeResponse);
|
||||||
|
rpc ChangeMe(ChangeMeRequest) returns (ChangeMeResponse);
|
||||||
|
rpc CreateUserRequest (CreateUserRequest) returns (CreateUserResponse);
|
||||||
|
}
|
||||||
|
message GetMeRequest {
|
||||||
|
string id = 1;
|
||||||
|
}
|
||||||
|
message GetMeResponse {
|
||||||
|
User user = 1;
|
||||||
|
}
|
||||||
|
message CreateUserRequest {
|
||||||
|
string id = 1;
|
||||||
|
}
|
||||||
|
message CreateUserResponse {
|
||||||
|
string success = 1;
|
||||||
|
}
|
||||||
|
message ChangeMeRequest {
|
||||||
|
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 ChangeMeResponse {
|
||||||
|
bool success = 1;
|
||||||
|
string message = 2;
|
||||||
|
}
|
||||||
|
message User {
|
||||||
|
string id = 1;
|
||||||
|
optional string username = 2;
|
||||||
|
optional string email = 3;
|
||||||
|
optional string phone = 4;
|
||||||
|
optional string full_name = 5;
|
||||||
|
bool is_ldap = 6;
|
||||||
|
optional string status = 7;
|
||||||
|
repeated string roles = 8;
|
||||||
|
optional string avatar_url = 9;
|
||||||
|
optional string employee_id = 10;
|
||||||
|
optional string presence = 11;
|
||||||
|
optional string last_active = 12;
|
||||||
|
optional string custom_status_text = 13;
|
||||||
|
optional string custom_status_emoji = 14;
|
||||||
|
optional string timezone = 15;
|
||||||
|
optional string language = 16;
|
||||||
|
bool two_fa_enabled = 17;
|
||||||
|
bool has_pin = 18;
|
||||||
|
}
|
||||||
@@ -4,8 +4,9 @@ export const PROTO_PATHS = {
|
|||||||
AUTH: join(__dirname, "../../proto/sso/auth.proto"),
|
AUTH: join(__dirname, "../../proto/sso/auth.proto"),
|
||||||
LDAP_AUTH: join(__dirname, "../../proto/sso/ldap-auth.proto"),
|
LDAP_AUTH: join(__dirname, "../../proto/sso/ldap-auth.proto"),
|
||||||
ACCOUNT: join(__dirname, "../../proto/sso/account.proto"),
|
ACCOUNT: join(__dirname, "../../proto/sso/account.proto"),
|
||||||
RBAC: join(__dirname, "../../proto/sso/rbac.proto"),
|
|
||||||
TWOFA: join(__dirname, "../../proto/sso/twofa.proto"),
|
TWOFA: join(__dirname, "../../proto/sso/twofa.proto"),
|
||||||
LDAP: join(__dirname, "../../proto/sso/ldap.proto"),
|
RBAC: join(__dirname, "../../proto/admin/rbac.proto"),
|
||||||
|
USERS: join(__dirname, "../../proto/users/users.proto"),
|
||||||
|
LDAP: join(__dirname, "../../proto/users/ldap.proto"),
|
||||||
SEARCH: join(__dirname, "../../proto/search/search.proto"),
|
SEARCH: join(__dirname, "../../proto/search/search.proto"),
|
||||||
} as const;
|
} as const;
|
||||||
|
|||||||
Reference in New Issue
Block a user