chore: auto-generate protobuf files [skip ci]

This commit is contained in:
github-actions[bot]
2026-04-01 09:12:45 +00:00
parent 0713605442
commit 352b63c60c
3 changed files with 1245 additions and 74 deletions

View File

@@ -21,28 +21,29 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
) )
type VerifyRequest struct { // ==========================================
// БАЗОВЫЕ И ПЕРЕИСПОЛЬЗУЕМЫЕ СТРУКТУРЫ
// ==========================================
type EmptyRequest struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
func (x *VerifyRequest) Reset() { func (x *EmptyRequest) Reset() {
*x = VerifyRequest{} *x = EmptyRequest{}
mi := &file_ldap_proto_msgTypes[0] mi := &file_ldap_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
func (x *VerifyRequest) String() string { func (x *EmptyRequest) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*VerifyRequest) ProtoMessage() {} func (*EmptyRequest) ProtoMessage() {}
func (x *VerifyRequest) ProtoReflect() protoreflect.Message { func (x *EmptyRequest) ProtoReflect() protoreflect.Message {
mi := &file_ldap_proto_msgTypes[0] mi := &file_ldap_proto_msgTypes[0]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -54,48 +55,34 @@ func (x *VerifyRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use VerifyRequest.ProtoReflect.Descriptor instead. // Deprecated: Use EmptyRequest.ProtoReflect.Descriptor instead.
func (*VerifyRequest) Descriptor() ([]byte, []int) { func (*EmptyRequest) Descriptor() ([]byte, []int) {
return file_ldap_proto_rawDescGZIP(), []int{0} return file_ldap_proto_rawDescGZIP(), []int{0}
} }
func (x *VerifyRequest) GetUsername() string { // Стандартный ответ для мутаций (создание, обновление, удаление)
if x != nil { type StatusResponse struct {
return x.Username
}
return ""
}
func (x *VerifyRequest) GetPassword() string {
if x != nil {
return x.Password
}
return ""
}
type VerifyResponse struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"`
User *UserData `protobuf:"bytes,3,opt,name=user,proto3" json:"user,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
func (x *VerifyResponse) Reset() { func (x *StatusResponse) Reset() {
*x = VerifyResponse{} *x = StatusResponse{}
mi := &file_ldap_proto_msgTypes[1] mi := &file_ldap_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
func (x *VerifyResponse) String() string { func (x *StatusResponse) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*VerifyResponse) ProtoMessage() {} func (*StatusResponse) ProtoMessage() {}
func (x *VerifyResponse) ProtoReflect() protoreflect.Message { func (x *StatusResponse) ProtoReflect() protoreflect.Message {
mi := &file_ldap_proto_msgTypes[1] mi := &file_ldap_proto_msgTypes[1]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -107,38 +94,36 @@ func (x *VerifyResponse) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use VerifyResponse.ProtoReflect.Descriptor instead. // Deprecated: Use StatusResponse.ProtoReflect.Descriptor instead.
func (*VerifyResponse) Descriptor() ([]byte, []int) { func (*StatusResponse) Descriptor() ([]byte, []int) {
return file_ldap_proto_rawDescGZIP(), []int{1} return file_ldap_proto_rawDescGZIP(), []int{1}
} }
func (x *VerifyResponse) GetSuccess() bool { func (x *StatusResponse) GetSuccess() bool {
if x != nil { if x != nil {
return x.Success return x.Success
} }
return false return false
} }
func (x *VerifyResponse) GetErrorMessage() string { func (x *StatusResponse) GetErrorMessage() string {
if x != nil { if x != nil {
return x.ErrorMessage return x.ErrorMessage
} }
return "" return ""
} }
func (x *VerifyResponse) GetUser() *UserData { // Полная модель пользователя
if x != nil {
return x.User
}
return nil
}
type UserData struct { type UserData struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Dn string `protobuf:"bytes,1,opt,name=dn,proto3" json:"dn,omitempty"` Dn string `protobuf:"bytes,1,opt,name=dn,proto3" json:"dn,omitempty"` // Полный путь в AD (Distinguished Name)
DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` // Логин (sAMAccountName)
Groups []string `protobuf:"bytes,3,rep,name=groups,proto3" json:"groups,omitempty"` DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` // ФИО (displayName)
IsActive bool `protobuf:"varint,4,opt,name=is_active,json=isActive,proto3" json:"is_active,omitempty"` Email string `protobuf:"bytes,4,opt,name=email,proto3" json:"email,omitempty"` // Почта (mail)
Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` // Описание/Должность (description)
Avatar []byte `protobuf:"bytes,6,opt,name=avatar,proto3" json:"avatar,omitempty"` // Аватарка в байтах (thumbnailPhoto)
Groups []string `protobuf:"bytes,7,rep,name=groups,proto3" json:"groups,omitempty"` // Список групп
IsActive bool `protobuf:"varint,8,opt,name=is_active,json=isActive,proto3" json:"is_active,omitempty"` // Статус аккаунта
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
@@ -180,6 +165,13 @@ func (x *UserData) GetDn() string {
return "" return ""
} }
func (x *UserData) GetUsername() string {
if x != nil {
return x.Username
}
return ""
}
func (x *UserData) GetDisplayName() string { func (x *UserData) GetDisplayName() string {
if x != nil { if x != nil {
return x.DisplayName return x.DisplayName
@@ -187,6 +179,27 @@ func (x *UserData) GetDisplayName() string {
return "" return ""
} }
func (x *UserData) GetEmail() string {
if x != nil {
return x.Email
}
return ""
}
func (x *UserData) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
func (x *UserData) GetAvatar() []byte {
if x != nil {
return x.Avatar
}
return nil
}
func (x *UserData) GetGroups() []string { func (x *UserData) GetGroups() []string {
if x != nil { if x != nil {
return x.Groups return x.Groups
@@ -201,27 +214,672 @@ func (x *UserData) GetIsActive() bool {
return false return false
} }
// Модель группы
type GroupData struct {
state protoimpl.MessageState `protogen:"open.v1"`
Dn string `protobuf:"bytes,1,opt,name=dn,proto3" json:"dn,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Короткое имя группы (cn)
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GroupData) Reset() {
*x = GroupData{}
mi := &file_ldap_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GroupData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GroupData) ProtoMessage() {}
func (x *GroupData) ProtoReflect() protoreflect.Message {
mi := &file_ldap_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GroupData.ProtoReflect.Descriptor instead.
func (*GroupData) Descriptor() ([]byte, []int) {
return file_ldap_proto_rawDescGZIP(), []int{3}
}
func (x *GroupData) GetDn() string {
if x != nil {
return x.Dn
}
return ""
}
func (x *GroupData) GetName() string {
if x != nil {
return x.Name
}
return ""
}
// --- Авторизация ---
type VerifyRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *VerifyRequest) Reset() {
*x = VerifyRequest{}
mi := &file_ldap_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *VerifyRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*VerifyRequest) ProtoMessage() {}
func (x *VerifyRequest) ProtoReflect() protoreflect.Message {
mi := &file_ldap_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use VerifyRequest.ProtoReflect.Descriptor instead.
func (*VerifyRequest) Descriptor() ([]byte, []int) {
return file_ldap_proto_rawDescGZIP(), []int{4}
}
func (x *VerifyRequest) GetUsername() string {
if x != nil {
return x.Username
}
return ""
}
func (x *VerifyRequest) GetPassword() string {
if x != nil {
return x.Password
}
return ""
}
type VerifyResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"`
User *UserData `protobuf:"bytes,3,opt,name=user,proto3" json:"user,omitempty"` // Отдаем полные данные при успешном входе
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *VerifyResponse) Reset() {
*x = VerifyResponse{}
mi := &file_ldap_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *VerifyResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*VerifyResponse) ProtoMessage() {}
func (x *VerifyResponse) ProtoReflect() protoreflect.Message {
mi := &file_ldap_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use VerifyResponse.ProtoReflect.Descriptor instead.
func (*VerifyResponse) Descriptor() ([]byte, []int) {
return file_ldap_proto_rawDescGZIP(), []int{5}
}
func (x *VerifyResponse) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
func (x *VerifyResponse) GetErrorMessage() string {
if x != nil {
return x.ErrorMessage
}
return ""
}
func (x *VerifyResponse) GetUser() *UserData {
if x != nil {
return x.User
}
return nil
}
// --- Списки ---
type UserListResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"`
Users []*UserData `protobuf:"bytes,3,rep,name=users,proto3" json:"users,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *UserListResponse) Reset() {
*x = UserListResponse{}
mi := &file_ldap_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *UserListResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserListResponse) ProtoMessage() {}
func (x *UserListResponse) ProtoReflect() protoreflect.Message {
mi := &file_ldap_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UserListResponse.ProtoReflect.Descriptor instead.
func (*UserListResponse) Descriptor() ([]byte, []int) {
return file_ldap_proto_rawDescGZIP(), []int{6}
}
func (x *UserListResponse) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
func (x *UserListResponse) GetErrorMessage() string {
if x != nil {
return x.ErrorMessage
}
return ""
}
func (x *UserListResponse) GetUsers() []*UserData {
if x != nil {
return x.Users
}
return nil
}
type GroupListResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"`
Groups []*GroupData `protobuf:"bytes,3,rep,name=groups,proto3" json:"groups,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GroupListResponse) Reset() {
*x = GroupListResponse{}
mi := &file_ldap_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GroupListResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GroupListResponse) ProtoMessage() {}
func (x *GroupListResponse) ProtoReflect() protoreflect.Message {
mi := &file_ldap_proto_msgTypes[7]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GroupListResponse.ProtoReflect.Descriptor instead.
func (*GroupListResponse) Descriptor() ([]byte, []int) {
return file_ldap_proto_rawDescGZIP(), []int{7}
}
func (x *GroupListResponse) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
func (x *GroupListResponse) GetErrorMessage() string {
if x != nil {
return x.ErrorMessage
}
return ""
}
func (x *GroupListResponse) GetGroups() []*GroupData {
if x != nil {
return x.Groups
}
return nil
}
// --- Управление профилем ---
type CreateUserRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
FullName string `protobuf:"bytes,2,opt,name=full_name,json=fullName,proto3" json:"full_name,omitempty"`
Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"`
Email *string `protobuf:"bytes,4,opt,name=email,proto3,oneof" json:"email,omitempty"` // Сразу при создании можно задать почту
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CreateUserRequest) Reset() {
*x = CreateUserRequest{}
mi := &file_ldap_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CreateUserRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreateUserRequest) ProtoMessage() {}
func (x *CreateUserRequest) ProtoReflect() protoreflect.Message {
mi := &file_ldap_proto_msgTypes[8]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CreateUserRequest.ProtoReflect.Descriptor instead.
func (*CreateUserRequest) Descriptor() ([]byte, []int) {
return file_ldap_proto_rawDescGZIP(), []int{8}
}
func (x *CreateUserRequest) GetUsername() string {
if x != nil {
return x.Username
}
return ""
}
func (x *CreateUserRequest) GetFullName() string {
if x != nil {
return x.FullName
}
return ""
}
func (x *CreateUserRequest) GetPassword() string {
if x != nil {
return x.Password
}
return ""
}
func (x *CreateUserRequest) GetEmail() string {
if x != nil && x.Email != nil {
return *x.Email
}
return ""
}
// Запрос на обновление. Используем optional для частичного обновления.
type UpdateUserRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` // Обязательное поле: кого обновляем
DisplayName *string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3,oneof" json:"display_name,omitempty"` // Новое ФИО (повлечет Rename CN)
Email *string `protobuf:"bytes,3,opt,name=email,proto3,oneof" json:"email,omitempty"` // Новая почта
Description *string `protobuf:"bytes,4,opt,name=description,proto3,oneof" json:"description,omitempty"` // Новое описание
Avatar []byte `protobuf:"bytes,5,opt,name=avatar,proto3,oneof" json:"avatar,omitempty"` // Новая аватарка (бинарник картинки)
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *UpdateUserRequest) Reset() {
*x = UpdateUserRequest{}
mi := &file_ldap_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *UpdateUserRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateUserRequest) ProtoMessage() {}
func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message {
mi := &file_ldap_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UpdateUserRequest.ProtoReflect.Descriptor instead.
func (*UpdateUserRequest) Descriptor() ([]byte, []int) {
return file_ldap_proto_rawDescGZIP(), []int{9}
}
func (x *UpdateUserRequest) GetUsername() string {
if x != nil {
return x.Username
}
return ""
}
func (x *UpdateUserRequest) GetDisplayName() string {
if x != nil && x.DisplayName != nil {
return *x.DisplayName
}
return ""
}
func (x *UpdateUserRequest) GetEmail() string {
if x != nil && x.Email != nil {
return *x.Email
}
return ""
}
func (x *UpdateUserRequest) GetDescription() string {
if x != nil && x.Description != nil {
return *x.Description
}
return ""
}
func (x *UpdateUserRequest) GetAvatar() []byte {
if x != nil {
return x.Avatar
}
return nil
}
type ChangePasswordRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
NewPassword string `protobuf:"bytes,2,opt,name=new_password,json=newPassword,proto3" json:"new_password,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ChangePasswordRequest) Reset() {
*x = ChangePasswordRequest{}
mi := &file_ldap_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ChangePasswordRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ChangePasswordRequest) ProtoMessage() {}
func (x *ChangePasswordRequest) ProtoReflect() protoreflect.Message {
mi := &file_ldap_proto_msgTypes[10]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ChangePasswordRequest.ProtoReflect.Descriptor instead.
func (*ChangePasswordRequest) Descriptor() ([]byte, []int) {
return file_ldap_proto_rawDescGZIP(), []int{10}
}
func (x *ChangePasswordRequest) GetUsername() string {
if x != nil {
return x.Username
}
return ""
}
func (x *ChangePasswordRequest) GetNewPassword() string {
if x != nil {
return x.NewPassword
}
return ""
}
type ToggleStatusRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
SetActive bool `protobuf:"varint,2,opt,name=set_active,json=setActive,proto3" json:"set_active,omitempty"` // true - включить (512), false - отключить (514)
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ToggleStatusRequest) Reset() {
*x = ToggleStatusRequest{}
mi := &file_ldap_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ToggleStatusRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ToggleStatusRequest) ProtoMessage() {}
func (x *ToggleStatusRequest) ProtoReflect() protoreflect.Message {
mi := &file_ldap_proto_msgTypes[11]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ToggleStatusRequest.ProtoReflect.Descriptor instead.
func (*ToggleStatusRequest) Descriptor() ([]byte, []int) {
return file_ldap_proto_rawDescGZIP(), []int{11}
}
func (x *ToggleStatusRequest) GetUsername() string {
if x != nil {
return x.Username
}
return ""
}
func (x *ToggleStatusRequest) GetSetActive() bool {
if x != nil {
return x.SetActive
}
return false
}
// --- Управление членством в группах ---
type GroupMemberRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` // Логин пользователя
GroupDn string `protobuf:"bytes,2,opt,name=group_dn,json=groupDn,proto3" json:"group_dn,omitempty"` // Полный путь группы (в которую добавляем / из которой удаляем)
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GroupMemberRequest) Reset() {
*x = GroupMemberRequest{}
mi := &file_ldap_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GroupMemberRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GroupMemberRequest) ProtoMessage() {}
func (x *GroupMemberRequest) ProtoReflect() protoreflect.Message {
mi := &file_ldap_proto_msgTypes[12]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GroupMemberRequest.ProtoReflect.Descriptor instead.
func (*GroupMemberRequest) Descriptor() ([]byte, []int) {
return file_ldap_proto_rawDescGZIP(), []int{12}
}
func (x *GroupMemberRequest) GetUsername() string {
if x != nil {
return x.Username
}
return ""
}
func (x *GroupMemberRequest) GetGroupDn() string {
if x != nil {
return x.GroupDn
}
return ""
}
var File_ldap_proto protoreflect.FileDescriptor var File_ldap_proto protoreflect.FileDescriptor
const file_ldap_proto_rawDesc = "" + const file_ldap_proto_rawDesc = "" +
"\n" + "\n" +
"\n" + "\n" +
"ldap.proto\x12\fldap_service\"G\n" + "ldap.proto\x12\fldap_service\"\x0e\n" +
"\fEmptyRequest\"O\n" +
"\x0eStatusResponse\x12\x18\n" +
"\asuccess\x18\x01 \x01(\bR\asuccess\x12#\n" +
"\rerror_message\x18\x02 \x01(\tR\ferrorMessage\"\xde\x01\n" +
"\bUserData\x12\x0e\n" +
"\x02dn\x18\x01 \x01(\tR\x02dn\x12\x1a\n" +
"\busername\x18\x02 \x01(\tR\busername\x12!\n" +
"\fdisplay_name\x18\x03 \x01(\tR\vdisplayName\x12\x14\n" +
"\x05email\x18\x04 \x01(\tR\x05email\x12 \n" +
"\vdescription\x18\x05 \x01(\tR\vdescription\x12\x16\n" +
"\x06avatar\x18\x06 \x01(\fR\x06avatar\x12\x16\n" +
"\x06groups\x18\a \x03(\tR\x06groups\x12\x1b\n" +
"\tis_active\x18\b \x01(\bR\bisActive\"/\n" +
"\tGroupData\x12\x0e\n" +
"\x02dn\x18\x01 \x01(\tR\x02dn\x12\x12\n" +
"\x04name\x18\x02 \x01(\tR\x04name\"G\n" +
"\rVerifyRequest\x12\x1a\n" + "\rVerifyRequest\x12\x1a\n" +
"\busername\x18\x01 \x01(\tR\busername\x12\x1a\n" + "\busername\x18\x01 \x01(\tR\busername\x12\x1a\n" +
"\bpassword\x18\x02 \x01(\tR\bpassword\"{\n" + "\bpassword\x18\x02 \x01(\tR\bpassword\"{\n" +
"\x0eVerifyResponse\x12\x18\n" + "\x0eVerifyResponse\x12\x18\n" +
"\asuccess\x18\x01 \x01(\bR\asuccess\x12#\n" + "\asuccess\x18\x01 \x01(\bR\asuccess\x12#\n" +
"\rerror_message\x18\x02 \x01(\tR\ferrorMessage\x12*\n" + "\rerror_message\x18\x02 \x01(\tR\ferrorMessage\x12*\n" +
"\x04user\x18\x03 \x01(\v2\x16.ldap_service.UserDataR\x04user\"r\n" + "\x04user\x18\x03 \x01(\v2\x16.ldap_service.UserDataR\x04user\"\x7f\n" +
"\bUserData\x12\x0e\n" + "\x10UserListResponse\x12\x18\n" +
"\x02dn\x18\x01 \x01(\tR\x02dn\x12!\n" + "\asuccess\x18\x01 \x01(\bR\asuccess\x12#\n" +
"\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12\x16\n" + "\rerror_message\x18\x02 \x01(\tR\ferrorMessage\x12,\n" +
"\x06groups\x18\x03 \x03(\tR\x06groups\x12\x1b\n" + "\x05users\x18\x03 \x03(\v2\x16.ldap_service.UserDataR\x05users\"\x83\x01\n" +
"\tis_active\x18\x04 \x01(\bR\bisActive2S\n" + "\x11GroupListResponse\x12\x18\n" +
"\asuccess\x18\x01 \x01(\bR\asuccess\x12#\n" +
"\rerror_message\x18\x02 \x01(\tR\ferrorMessage\x12/\n" +
"\x06groups\x18\x03 \x03(\v2\x17.ldap_service.GroupDataR\x06groups\"\x8d\x01\n" +
"\x11CreateUserRequest\x12\x1a\n" +
"\busername\x18\x01 \x01(\tR\busername\x12\x1b\n" +
"\tfull_name\x18\x02 \x01(\tR\bfullName\x12\x1a\n" +
"\bpassword\x18\x03 \x01(\tR\bpassword\x12\x19\n" +
"\x05email\x18\x04 \x01(\tH\x00R\x05email\x88\x01\x01B\b\n" +
"\x06_email\"\xec\x01\n" +
"\x11UpdateUserRequest\x12\x1a\n" +
"\busername\x18\x01 \x01(\tR\busername\x12&\n" +
"\fdisplay_name\x18\x02 \x01(\tH\x00R\vdisplayName\x88\x01\x01\x12\x19\n" +
"\x05email\x18\x03 \x01(\tH\x01R\x05email\x88\x01\x01\x12%\n" +
"\vdescription\x18\x04 \x01(\tH\x02R\vdescription\x88\x01\x01\x12\x1b\n" +
"\x06avatar\x18\x05 \x01(\fH\x03R\x06avatar\x88\x01\x01B\x0f\n" +
"\r_display_nameB\b\n" +
"\x06_emailB\x0e\n" +
"\f_descriptionB\t\n" +
"\a_avatar\"V\n" +
"\x15ChangePasswordRequest\x12\x1a\n" +
"\busername\x18\x01 \x01(\tR\busername\x12!\n" +
"\fnew_password\x18\x02 \x01(\tR\vnewPassword\"P\n" +
"\x13ToggleStatusRequest\x12\x1a\n" +
"\busername\x18\x01 \x01(\tR\busername\x12\x1d\n" +
"\n" +
"set_active\x18\x02 \x01(\bR\tsetActive\"K\n" +
"\x12GroupMemberRequest\x12\x1a\n" +
"\busername\x18\x01 \x01(\tR\busername\x12\x19\n" +
"\bgroup_dn\x18\x02 \x01(\tR\agroupDn2\xd2\x05\n" +
"\bLdapAuth\x12G\n" + "\bLdapAuth\x12G\n" +
"\n" + "\n" +
"VerifyUser\x12\x1b.ldap_service.VerifyRequest\x1a\x1c.ldap_service.VerifyResponseB<Z:git.lendry.ru/lendry-erp/contracts.git/gen/go;ldap_serviceb\x06proto3" "VerifyUser\x12\x1b.ldap_service.VerifyRequest\x1a\x1c.ldap_service.VerifyResponse\x12F\n" +
"\bGetUsers\x12\x1a.ldap_service.EmptyRequest\x1a\x1e.ldap_service.UserListResponse\x12K\n" +
"\n" +
"CreateUser\x12\x1f.ldap_service.CreateUserRequest\x1a\x1c.ldap_service.StatusResponse\x12K\n" +
"\n" +
"UpdateUser\x12\x1f.ldap_service.UpdateUserRequest\x1a\x1c.ldap_service.StatusResponse\x12S\n" +
"\x0eChangePassword\x12#.ldap_service.ChangePasswordRequest\x1a\x1c.ldap_service.StatusResponse\x12S\n" +
"\x10ToggleUserStatus\x12!.ldap_service.ToggleStatusRequest\x1a\x1c.ldap_service.StatusResponse\x12H\n" +
"\tGetGroups\x12\x1a.ldap_service.EmptyRequest\x1a\x1f.ldap_service.GroupListResponse\x12P\n" +
"\x0eAddUserToGroup\x12 .ldap_service.GroupMemberRequest\x1a\x1c.ldap_service.StatusResponse\x12U\n" +
"\x13RemoveUserFromGroup\x12 .ldap_service.GroupMemberRequest\x1a\x1c.ldap_service.StatusResponseB<Z:git.lendry.ru/lendry-erp/contracts.git/gen/go;ldap_serviceb\x06proto3"
var ( var (
file_ldap_proto_rawDescOnce sync.Once file_ldap_proto_rawDescOnce sync.Once
@@ -235,21 +893,49 @@ func file_ldap_proto_rawDescGZIP() []byte {
return file_ldap_proto_rawDescData return file_ldap_proto_rawDescData
} }
var file_ldap_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_ldap_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_ldap_proto_goTypes = []any{ var file_ldap_proto_goTypes = []any{
(*VerifyRequest)(nil), // 0: ldap_service.VerifyRequest (*EmptyRequest)(nil), // 0: ldap_service.EmptyRequest
(*VerifyResponse)(nil), // 1: ldap_service.VerifyResponse (*StatusResponse)(nil), // 1: ldap_service.StatusResponse
(*UserData)(nil), // 2: ldap_service.UserData (*UserData)(nil), // 2: ldap_service.UserData
(*GroupData)(nil), // 3: ldap_service.GroupData
(*VerifyRequest)(nil), // 4: ldap_service.VerifyRequest
(*VerifyResponse)(nil), // 5: ldap_service.VerifyResponse
(*UserListResponse)(nil), // 6: ldap_service.UserListResponse
(*GroupListResponse)(nil), // 7: ldap_service.GroupListResponse
(*CreateUserRequest)(nil), // 8: ldap_service.CreateUserRequest
(*UpdateUserRequest)(nil), // 9: ldap_service.UpdateUserRequest
(*ChangePasswordRequest)(nil), // 10: ldap_service.ChangePasswordRequest
(*ToggleStatusRequest)(nil), // 11: ldap_service.ToggleStatusRequest
(*GroupMemberRequest)(nil), // 12: ldap_service.GroupMemberRequest
} }
var file_ldap_proto_depIdxs = []int32{ var file_ldap_proto_depIdxs = []int32{
2, // 0: ldap_service.VerifyResponse.user:type_name -> ldap_service.UserData 2, // 0: ldap_service.VerifyResponse.user:type_name -> ldap_service.UserData
0, // 1: ldap_service.LdapAuth.VerifyUser:input_type -> ldap_service.VerifyRequest 2, // 1: ldap_service.UserListResponse.users:type_name -> ldap_service.UserData
1, // 2: ldap_service.LdapAuth.VerifyUser:output_type -> ldap_service.VerifyResponse 3, // 2: ldap_service.GroupListResponse.groups:type_name -> ldap_service.GroupData
2, // [2:3] is the sub-list for method output_type 4, // 3: ldap_service.LdapAuth.VerifyUser:input_type -> ldap_service.VerifyRequest
1, // [1:2] is the sub-list for method input_type 0, // 4: ldap_service.LdapAuth.GetUsers:input_type -> ldap_service.EmptyRequest
1, // [1:1] is the sub-list for extension type_name 8, // 5: ldap_service.LdapAuth.CreateUser:input_type -> ldap_service.CreateUserRequest
1, // [1:1] is the sub-list for extension extendee 9, // 6: ldap_service.LdapAuth.UpdateUser:input_type -> ldap_service.UpdateUserRequest
0, // [0:1] is the sub-list for field type_name 10, // 7: ldap_service.LdapAuth.ChangePassword:input_type -> ldap_service.ChangePasswordRequest
11, // 8: ldap_service.LdapAuth.ToggleUserStatus:input_type -> ldap_service.ToggleStatusRequest
0, // 9: ldap_service.LdapAuth.GetGroups:input_type -> ldap_service.EmptyRequest
12, // 10: ldap_service.LdapAuth.AddUserToGroup:input_type -> ldap_service.GroupMemberRequest
12, // 11: ldap_service.LdapAuth.RemoveUserFromGroup:input_type -> ldap_service.GroupMemberRequest
5, // 12: ldap_service.LdapAuth.VerifyUser:output_type -> ldap_service.VerifyResponse
6, // 13: ldap_service.LdapAuth.GetUsers:output_type -> ldap_service.UserListResponse
1, // 14: ldap_service.LdapAuth.CreateUser:output_type -> ldap_service.StatusResponse
1, // 15: ldap_service.LdapAuth.UpdateUser:output_type -> ldap_service.StatusResponse
1, // 16: ldap_service.LdapAuth.ChangePassword:output_type -> ldap_service.StatusResponse
1, // 17: ldap_service.LdapAuth.ToggleUserStatus:output_type -> ldap_service.StatusResponse
7, // 18: ldap_service.LdapAuth.GetGroups:output_type -> ldap_service.GroupListResponse
1, // 19: ldap_service.LdapAuth.AddUserToGroup:output_type -> ldap_service.StatusResponse
1, // 20: ldap_service.LdapAuth.RemoveUserFromGroup:output_type -> ldap_service.StatusResponse
12, // [12:21] is the sub-list for method output_type
3, // [3:12] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
} }
func init() { file_ldap_proto_init() } func init() { file_ldap_proto_init() }
@@ -257,13 +943,15 @@ func file_ldap_proto_init() {
if File_ldap_proto != nil { if File_ldap_proto != nil {
return return
} }
file_ldap_proto_msgTypes[8].OneofWrappers = []any{}
file_ldap_proto_msgTypes[9].OneofWrappers = []any{}
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ldap_proto_rawDesc), len(file_ldap_proto_rawDesc)), RawDescriptor: unsafe.Slice(unsafe.StringData(file_ldap_proto_rawDesc), len(file_ldap_proto_rawDesc)),
NumEnums: 0, NumEnums: 0,
NumMessages: 3, NumMessages: 13,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },

View File

@@ -20,13 +20,36 @@ const _ = grpc.SupportPackageIsVersion9
const ( const (
LdapAuth_VerifyUser_FullMethodName = "/ldap_service.LdapAuth/VerifyUser" LdapAuth_VerifyUser_FullMethodName = "/ldap_service.LdapAuth/VerifyUser"
LdapAuth_GetUsers_FullMethodName = "/ldap_service.LdapAuth/GetUsers"
LdapAuth_CreateUser_FullMethodName = "/ldap_service.LdapAuth/CreateUser"
LdapAuth_UpdateUser_FullMethodName = "/ldap_service.LdapAuth/UpdateUser"
LdapAuth_ChangePassword_FullMethodName = "/ldap_service.LdapAuth/ChangePassword"
LdapAuth_ToggleUserStatus_FullMethodName = "/ldap_service.LdapAuth/ToggleUserStatus"
LdapAuth_GetGroups_FullMethodName = "/ldap_service.LdapAuth/GetGroups"
LdapAuth_AddUserToGroup_FullMethodName = "/ldap_service.LdapAuth/AddUserToGroup"
LdapAuth_RemoveUserFromGroup_FullMethodName = "/ldap_service.LdapAuth/RemoveUserFromGroup"
) )
// LdapAuthClient is the client API for LdapAuth service. // LdapAuthClient is the client API for LdapAuth service.
// //
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// ==========================================
// ГЛАВНЫЙ СЕРВИС
// ==========================================
type LdapAuthClient interface { type LdapAuthClient interface {
// --- Вектор 1: Авторизация (Bind от имени пользователя) ---
VerifyUser(ctx context.Context, in *VerifyRequest, opts ...grpc.CallOption) (*VerifyResponse, error) VerifyUser(ctx context.Context, in *VerifyRequest, opts ...grpc.CallOption) (*VerifyResponse, error)
// --- Вектор 2: Управление Пользователями (Bind системного аккаунта) ---
GetUsers(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*UserListResponse, error)
CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*StatusResponse, error)
UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*StatusResponse, error)
ChangePassword(ctx context.Context, in *ChangePasswordRequest, opts ...grpc.CallOption) (*StatusResponse, error)
ToggleUserStatus(ctx context.Context, in *ToggleStatusRequest, opts ...grpc.CallOption) (*StatusResponse, error)
// --- Вектор 3: Управление Группами ---
GetGroups(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*GroupListResponse, error)
AddUserToGroup(ctx context.Context, in *GroupMemberRequest, opts ...grpc.CallOption) (*StatusResponse, error)
RemoveUserFromGroup(ctx context.Context, in *GroupMemberRequest, opts ...grpc.CallOption) (*StatusResponse, error)
} }
type ldapAuthClient struct { type ldapAuthClient struct {
@@ -47,11 +70,106 @@ func (c *ldapAuthClient) VerifyUser(ctx context.Context, in *VerifyRequest, opts
return out, nil return out, nil
} }
func (c *ldapAuthClient) GetUsers(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*UserListResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UserListResponse)
err := c.cc.Invoke(ctx, LdapAuth_GetUsers_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ldapAuthClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*StatusResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusResponse)
err := c.cc.Invoke(ctx, LdapAuth_CreateUser_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ldapAuthClient) UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*StatusResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusResponse)
err := c.cc.Invoke(ctx, LdapAuth_UpdateUser_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ldapAuthClient) ChangePassword(ctx context.Context, in *ChangePasswordRequest, opts ...grpc.CallOption) (*StatusResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusResponse)
err := c.cc.Invoke(ctx, LdapAuth_ChangePassword_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ldapAuthClient) ToggleUserStatus(ctx context.Context, in *ToggleStatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusResponse)
err := c.cc.Invoke(ctx, LdapAuth_ToggleUserStatus_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ldapAuthClient) GetGroups(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*GroupListResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GroupListResponse)
err := c.cc.Invoke(ctx, LdapAuth_GetGroups_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ldapAuthClient) AddUserToGroup(ctx context.Context, in *GroupMemberRequest, opts ...grpc.CallOption) (*StatusResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusResponse)
err := c.cc.Invoke(ctx, LdapAuth_AddUserToGroup_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ldapAuthClient) RemoveUserFromGroup(ctx context.Context, in *GroupMemberRequest, opts ...grpc.CallOption) (*StatusResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusResponse)
err := c.cc.Invoke(ctx, LdapAuth_RemoveUserFromGroup_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// LdapAuthServer is the server API for LdapAuth service. // LdapAuthServer is the server API for LdapAuth service.
// All implementations must embed UnimplementedLdapAuthServer // All implementations must embed UnimplementedLdapAuthServer
// for forward compatibility. // for forward compatibility.
//
// ==========================================
// ГЛАВНЫЙ СЕРВИС
// ==========================================
type LdapAuthServer interface { type LdapAuthServer interface {
// --- Вектор 1: Авторизация (Bind от имени пользователя) ---
VerifyUser(context.Context, *VerifyRequest) (*VerifyResponse, error) VerifyUser(context.Context, *VerifyRequest) (*VerifyResponse, error)
// --- Вектор 2: Управление Пользователями (Bind системного аккаунта) ---
GetUsers(context.Context, *EmptyRequest) (*UserListResponse, error)
CreateUser(context.Context, *CreateUserRequest) (*StatusResponse, error)
UpdateUser(context.Context, *UpdateUserRequest) (*StatusResponse, error)
ChangePassword(context.Context, *ChangePasswordRequest) (*StatusResponse, error)
ToggleUserStatus(context.Context, *ToggleStatusRequest) (*StatusResponse, error)
// --- Вектор 3: Управление Группами ---
GetGroups(context.Context, *EmptyRequest) (*GroupListResponse, error)
AddUserToGroup(context.Context, *GroupMemberRequest) (*StatusResponse, error)
RemoveUserFromGroup(context.Context, *GroupMemberRequest) (*StatusResponse, error)
mustEmbedUnimplementedLdapAuthServer() mustEmbedUnimplementedLdapAuthServer()
} }
@@ -65,6 +183,30 @@ type UnimplementedLdapAuthServer struct{}
func (UnimplementedLdapAuthServer) VerifyUser(context.Context, *VerifyRequest) (*VerifyResponse, error) { func (UnimplementedLdapAuthServer) VerifyUser(context.Context, *VerifyRequest) (*VerifyResponse, error) {
return nil, status.Error(codes.Unimplemented, "method VerifyUser not implemented") return nil, status.Error(codes.Unimplemented, "method VerifyUser not implemented")
} }
func (UnimplementedLdapAuthServer) GetUsers(context.Context, *EmptyRequest) (*UserListResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetUsers not implemented")
}
func (UnimplementedLdapAuthServer) CreateUser(context.Context, *CreateUserRequest) (*StatusResponse, error) {
return nil, status.Error(codes.Unimplemented, "method CreateUser not implemented")
}
func (UnimplementedLdapAuthServer) UpdateUser(context.Context, *UpdateUserRequest) (*StatusResponse, error) {
return nil, status.Error(codes.Unimplemented, "method UpdateUser not implemented")
}
func (UnimplementedLdapAuthServer) ChangePassword(context.Context, *ChangePasswordRequest) (*StatusResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ChangePassword not implemented")
}
func (UnimplementedLdapAuthServer) ToggleUserStatus(context.Context, *ToggleStatusRequest) (*StatusResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ToggleUserStatus not implemented")
}
func (UnimplementedLdapAuthServer) GetGroups(context.Context, *EmptyRequest) (*GroupListResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetGroups not implemented")
}
func (UnimplementedLdapAuthServer) AddUserToGroup(context.Context, *GroupMemberRequest) (*StatusResponse, error) {
return nil, status.Error(codes.Unimplemented, "method AddUserToGroup not implemented")
}
func (UnimplementedLdapAuthServer) RemoveUserFromGroup(context.Context, *GroupMemberRequest) (*StatusResponse, error) {
return nil, status.Error(codes.Unimplemented, "method RemoveUserFromGroup not implemented")
}
func (UnimplementedLdapAuthServer) mustEmbedUnimplementedLdapAuthServer() {} func (UnimplementedLdapAuthServer) mustEmbedUnimplementedLdapAuthServer() {}
func (UnimplementedLdapAuthServer) testEmbeddedByValue() {} func (UnimplementedLdapAuthServer) testEmbeddedByValue() {}
@@ -104,6 +246,150 @@ func _LdapAuth_VerifyUser_Handler(srv interface{}, ctx context.Context, dec func
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _LdapAuth_GetUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EmptyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LdapAuthServer).GetUsers(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LdapAuth_GetUsers_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LdapAuthServer).GetUsers(ctx, req.(*EmptyRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LdapAuth_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LdapAuthServer).CreateUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LdapAuth_CreateUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LdapAuthServer).CreateUser(ctx, req.(*CreateUserRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LdapAuth_UpdateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LdapAuthServer).UpdateUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LdapAuth_UpdateUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LdapAuthServer).UpdateUser(ctx, req.(*UpdateUserRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LdapAuth_ChangePassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ChangePasswordRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LdapAuthServer).ChangePassword(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LdapAuth_ChangePassword_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LdapAuthServer).ChangePassword(ctx, req.(*ChangePasswordRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LdapAuth_ToggleUserStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ToggleStatusRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LdapAuthServer).ToggleUserStatus(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LdapAuth_ToggleUserStatus_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LdapAuthServer).ToggleUserStatus(ctx, req.(*ToggleStatusRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LdapAuth_GetGroups_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EmptyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LdapAuthServer).GetGroups(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LdapAuth_GetGroups_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LdapAuthServer).GetGroups(ctx, req.(*EmptyRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LdapAuth_AddUserToGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GroupMemberRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LdapAuthServer).AddUserToGroup(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LdapAuth_AddUserToGroup_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LdapAuthServer).AddUserToGroup(ctx, req.(*GroupMemberRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LdapAuth_RemoveUserFromGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GroupMemberRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LdapAuthServer).RemoveUserFromGroup(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LdapAuth_RemoveUserFromGroup_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LdapAuthServer).RemoveUserFromGroup(ctx, req.(*GroupMemberRequest))
}
return interceptor(ctx, in, info, handler)
}
// LdapAuth_ServiceDesc is the grpc.ServiceDesc for LdapAuth service. // LdapAuth_ServiceDesc is the grpc.ServiceDesc for LdapAuth service.
// It's only intended for direct use with grpc.RegisterService, // It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy) // and not to be introspected or modified (even as a copy)
@@ -115,6 +401,38 @@ var LdapAuth_ServiceDesc = grpc.ServiceDesc{
MethodName: "VerifyUser", MethodName: "VerifyUser",
Handler: _LdapAuth_VerifyUser_Handler, Handler: _LdapAuth_VerifyUser_Handler,
}, },
{
MethodName: "GetUsers",
Handler: _LdapAuth_GetUsers_Handler,
},
{
MethodName: "CreateUser",
Handler: _LdapAuth_CreateUser_Handler,
},
{
MethodName: "UpdateUser",
Handler: _LdapAuth_UpdateUser_Handler,
},
{
MethodName: "ChangePassword",
Handler: _LdapAuth_ChangePassword_Handler,
},
{
MethodName: "ToggleUserStatus",
Handler: _LdapAuth_ToggleUserStatus_Handler,
},
{
MethodName: "GetGroups",
Handler: _LdapAuth_GetGroups_Handler,
},
{
MethodName: "AddUserToGroup",
Handler: _LdapAuth_AddUserToGroup_Handler,
},
{
MethodName: "RemoveUserFromGroup",
Handler: _LdapAuth_RemoveUserFromGroup_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "ldap.proto", Metadata: "ldap.proto",

View File

@@ -10,6 +10,48 @@ import { Observable } from "rxjs";
export const protobufPackage = "ldap_service"; export const protobufPackage = "ldap_service";
/**
* ==========================================
* БАЗОВЫЕ И ПЕРЕИСПОЛЬЗУЕМЫЕ СТРУКТУРЫ
* ==========================================
*/
export interface EmptyRequest {
}
/** Стандартный ответ для мутаций (создание, обновление, удаление) */
export interface StatusResponse {
success: boolean;
errorMessage: string;
}
/** Полная модель пользователя */
export interface UserData {
/** Полный путь в AD (Distinguished Name) */
dn: string;
/** Логин (sAMAccountName) */
username: string;
/** ФИО (displayName) */
displayName: string;
/** Почта (mail) */
email: string;
/** Описание/Должность (description) */
description: string;
/** Аватарка в байтах (thumbnailPhoto) */
avatar: Uint8Array;
/** Список групп */
groups: string[];
/** Статус аккаунта */
isActive: boolean;
}
/** Модель группы */
export interface GroupData {
dn: string;
/** Короткое имя группы (cn) */
name: string;
}
/** --- Авторизация --- */
export interface VerifyRequest { export interface VerifyRequest {
username: string; username: string;
password: string; password: string;
@@ -18,29 +60,152 @@ export interface VerifyRequest {
export interface VerifyResponse { export interface VerifyResponse {
success: boolean; success: boolean;
errorMessage: string; errorMessage: string;
/** Отдаем полные данные при успешном входе */
user: UserData | undefined; user: UserData | undefined;
} }
export interface UserData { /** --- Списки --- */
dn: string; export interface UserListResponse {
displayName: string; success: boolean;
groups: string[]; errorMessage: string;
isActive: boolean; users: UserData[];
}
export interface GroupListResponse {
success: boolean;
errorMessage: string;
groups: GroupData[];
}
/** --- Управление профилем --- */
export interface CreateUserRequest {
username: string;
fullName: string;
password: string;
/** Сразу при создании можно задать почту */
email?: string | undefined;
}
/** Запрос на обновление. Используем optional для частичного обновления. */
export interface UpdateUserRequest {
/** Обязательное поле: кого обновляем */
username: string;
/** Новое ФИО (повлечет Rename CN) */
displayName?:
| string
| undefined;
/** Новая почта */
email?:
| string
| undefined;
/** Новое описание */
description?:
| string
| undefined;
/** Новая аватарка (бинарник картинки) */
avatar?: Uint8Array | undefined;
}
export interface ChangePasswordRequest {
username: string;
newPassword: string;
}
export interface ToggleStatusRequest {
username: string;
/** true - включить (512), false - отключить (514) */
setActive: boolean;
}
/** --- Управление членством в группах --- */
export interface GroupMemberRequest {
/** Логин пользователя */
username: string;
/** Полный путь группы (в которую добавляем / из которой удаляем) */
groupDn: string;
} }
export const LDAP_SERVICE_PACKAGE_NAME = "ldap_service"; export const LDAP_SERVICE_PACKAGE_NAME = "ldap_service";
/**
* ==========================================
* ГЛАВНЫЙ СЕРВИС
* ==========================================
*/
export interface LdapAuthClient { export interface LdapAuthClient {
/** --- Вектор 1: Авторизация (Bind от имени пользователя) --- */
verifyUser(request: VerifyRequest): Observable<VerifyResponse>; verifyUser(request: VerifyRequest): Observable<VerifyResponse>;
/** --- Вектор 2: Управление Пользователями (Bind системного аккаунта) --- */
getUsers(request: EmptyRequest): Observable<UserListResponse>;
createUser(request: CreateUserRequest): Observable<StatusResponse>;
updateUser(request: UpdateUserRequest): Observable<StatusResponse>;
changePassword(request: ChangePasswordRequest): Observable<StatusResponse>;
toggleUserStatus(request: ToggleStatusRequest): Observable<StatusResponse>;
/** --- Вектор 3: Управление Группами --- */
getGroups(request: EmptyRequest): Observable<GroupListResponse>;
addUserToGroup(request: GroupMemberRequest): Observable<StatusResponse>;
removeUserFromGroup(request: GroupMemberRequest): Observable<StatusResponse>;
} }
/**
* ==========================================
* ГЛАВНЫЙ СЕРВИС
* ==========================================
*/
export interface LdapAuthController { export interface LdapAuthController {
/** --- Вектор 1: Авторизация (Bind от имени пользователя) --- */
verifyUser(request: VerifyRequest): Promise<VerifyResponse> | Observable<VerifyResponse> | VerifyResponse; verifyUser(request: VerifyRequest): Promise<VerifyResponse> | Observable<VerifyResponse> | VerifyResponse;
/** --- Вектор 2: Управление Пользователями (Bind системного аккаунта) --- */
getUsers(request: EmptyRequest): Promise<UserListResponse> | Observable<UserListResponse> | UserListResponse;
createUser(request: CreateUserRequest): Promise<StatusResponse> | Observable<StatusResponse> | StatusResponse;
updateUser(request: UpdateUserRequest): Promise<StatusResponse> | Observable<StatusResponse> | StatusResponse;
changePassword(request: ChangePasswordRequest): Promise<StatusResponse> | Observable<StatusResponse> | StatusResponse;
toggleUserStatus(request: ToggleStatusRequest): Promise<StatusResponse> | Observable<StatusResponse> | StatusResponse;
/** --- Вектор 3: Управление Группами --- */
getGroups(request: EmptyRequest): Promise<GroupListResponse> | Observable<GroupListResponse> | GroupListResponse;
addUserToGroup(request: GroupMemberRequest): Promise<StatusResponse> | Observable<StatusResponse> | StatusResponse;
removeUserFromGroup(
request: GroupMemberRequest,
): Promise<StatusResponse> | Observable<StatusResponse> | StatusResponse;
} }
export function LdapAuthControllerMethods() { export function LdapAuthControllerMethods() {
return function (constructor: Function) { return function (constructor: Function) {
const grpcMethods: string[] = ["verifyUser"]; const grpcMethods: string[] = [
"verifyUser",
"getUsers",
"createUser",
"updateUser",
"changePassword",
"toggleUserStatus",
"getGroups",
"addUserToGroup",
"removeUserFromGroup",
];
for (const method of grpcMethods) { for (const method of grpcMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcMethod("LdapAuth", method)(constructor.prototype[method], method, descriptor); GrpcMethod("LdapAuth", method)(constructor.prototype[method], method, descriptor);