This commit is contained in:
95
proto/users/ldap.proto
Normal file
95
proto/users/ldap.proto
Normal file
@@ -0,0 +1,95 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ldap.v1;
|
||||
|
||||
option go_package = "git.lendry.ru/lendry-erp/proto.git/go;pb";
|
||||
|
||||
service LdapService {
|
||||
// Управление Пользователями (Bind системного аккаунта) ---
|
||||
rpc GetUsers (EmptyRequest) returns (UserListResponse);
|
||||
rpc CreateUser (CreateUserRequest) returns (StatusResponse);
|
||||
rpc UpdateUser (UpdateUserRequest) returns (StatusResponse);
|
||||
rpc ChangePassword (ChangePasswordRequest) returns (StatusResponse);
|
||||
rpc ToggleUserStatus (ToggleStatusRequest) returns (StatusResponse);
|
||||
|
||||
// Управление Группами ---
|
||||
rpc GetGroups (EmptyRequest) returns (GroupListResponse);
|
||||
rpc AddUserToGroup (GroupMemberRequest) returns (StatusResponse);
|
||||
rpc RemoveUserFromGroup (GroupMemberRequest) returns (StatusResponse);
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// БАЗОВЫЕ И ПЕРЕИСПОЛЬЗУЕМЫЕ СТРУКТУРЫ
|
||||
// ==========================================
|
||||
message EmptyRequest {}
|
||||
|
||||
// Стандартный ответ для мутаций (создание, обновление, удаление)
|
||||
message StatusResponse {
|
||||
bool success = 1;
|
||||
string error_message = 2;
|
||||
}
|
||||
|
||||
// Полная модель пользователя
|
||||
message UserData {
|
||||
string dn = 1; // Полный путь в AD (Distinguished Name)
|
||||
string username = 2; // Логин (sAMAccountName)
|
||||
string display_name = 3; // ФИО (displayName)
|
||||
string email = 4; // Почта (mail)
|
||||
string description = 5; // Описание/Должность (description)
|
||||
bytes avatar = 6; // Аватарка в байтах (thumbnailPhoto)
|
||||
repeated string groups = 7; // Список групп
|
||||
bool is_active = 8; // Статус аккаунта
|
||||
string phone = 9;
|
||||
}
|
||||
|
||||
// Модель группы
|
||||
message GroupData {
|
||||
string dn = 1;
|
||||
string name = 2; // Короткое имя группы (cn)
|
||||
}
|
||||
|
||||
// --- Списки ---
|
||||
message UserListResponse {
|
||||
bool success = 1;
|
||||
string error_message = 2;
|
||||
repeated UserData users = 3;
|
||||
}
|
||||
|
||||
message GroupListResponse {
|
||||
bool success = 1;
|
||||
string error_message = 2;
|
||||
repeated GroupData groups = 3;
|
||||
}
|
||||
|
||||
// --- Управление профилем ---
|
||||
message CreateUserRequest {
|
||||
string username = 1;
|
||||
string full_name = 2;
|
||||
string password = 3;
|
||||
optional string email = 4; // Сразу при создании можно задать почту
|
||||
}
|
||||
|
||||
// Запрос на обновление. Используем optional для частичного обновления.
|
||||
message UpdateUserRequest {
|
||||
string username = 1; // Обязательное поле: кого обновляем
|
||||
optional string display_name = 2; // Новое ФИО (повлечет Rename CN)
|
||||
optional string email = 3; // Новая почта
|
||||
optional string description = 4; // Новое описание
|
||||
optional bytes avatar = 5; // Новая аватарка (бинарник картинки)
|
||||
}
|
||||
|
||||
message ChangePasswordRequest {
|
||||
string username = 1;
|
||||
string new_password = 2;
|
||||
}
|
||||
|
||||
message ToggleStatusRequest {
|
||||
string username = 1;
|
||||
bool set_active = 2; // true - включить (512), false - отключить (514)
|
||||
}
|
||||
|
||||
// --- Управление членством в группах ---
|
||||
message GroupMemberRequest {
|
||||
string username = 1; // Логин пользователя
|
||||
string group_dn = 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;
|
||||
}
|
||||
Reference in New Issue
Block a user