212 lines
6.4 KiB
TypeScript
212 lines
6.4 KiB
TypeScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
// versions:
|
|
// protoc-gen-ts_proto v2.11.6
|
|
// protoc v4.25.9
|
|
// source: sso/ldap.proto
|
|
|
|
/* eslint-disable */
|
|
import type { Metadata } from "@grpc/grpc-js";
|
|
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
import { Observable } from "rxjs";
|
|
|
|
export const protobufPackage = "ldap.v1";
|
|
|
|
/**
|
|
* ==========================================
|
|
* БАЗОВЫЕ И ПЕРЕИСПОЛЬЗУЕМЫЕ СТРУКТУРЫ
|
|
* ==========================================
|
|
*/
|
|
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;
|
|
phone: string;
|
|
}
|
|
|
|
/** Модель группы */
|
|
export interface GroupData {
|
|
dn: string;
|
|
/** Короткое имя группы (cn) */
|
|
name: string;
|
|
}
|
|
|
|
/** --- Списки --- */
|
|
export interface UserListResponse {
|
|
success: boolean;
|
|
errorMessage: string;
|
|
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_V1_PACKAGE_NAME = "ldap.v1";
|
|
|
|
export interface LdapServiceClient {
|
|
/** Управление Пользователями (Bind системного аккаунта) --- */
|
|
|
|
getUsers(request: EmptyRequest, metadata?: Metadata): Observable<UserListResponse>;
|
|
|
|
createUser(request: CreateUserRequest, metadata?: Metadata): Observable<StatusResponse>;
|
|
|
|
updateUser(request: UpdateUserRequest, metadata?: Metadata): Observable<StatusResponse>;
|
|
|
|
changePassword(request: ChangePasswordRequest, metadata?: Metadata): Observable<StatusResponse>;
|
|
|
|
toggleUserStatus(request: ToggleStatusRequest, metadata?: Metadata): Observable<StatusResponse>;
|
|
|
|
/** Управление Группами --- */
|
|
|
|
getGroups(request: EmptyRequest, metadata?: Metadata): Observable<GroupListResponse>;
|
|
|
|
addUserToGroup(request: GroupMemberRequest, metadata?: Metadata): Observable<StatusResponse>;
|
|
|
|
removeUserFromGroup(request: GroupMemberRequest, metadata?: Metadata): Observable<StatusResponse>;
|
|
}
|
|
|
|
export interface LdapServiceController {
|
|
/** Управление Пользователями (Bind системного аккаунта) --- */
|
|
|
|
getUsers(
|
|
request: EmptyRequest,
|
|
metadata?: Metadata,
|
|
): Promise<UserListResponse> | Observable<UserListResponse> | UserListResponse;
|
|
|
|
createUser(
|
|
request: CreateUserRequest,
|
|
metadata?: Metadata,
|
|
): Promise<StatusResponse> | Observable<StatusResponse> | StatusResponse;
|
|
|
|
updateUser(
|
|
request: UpdateUserRequest,
|
|
metadata?: Metadata,
|
|
): Promise<StatusResponse> | Observable<StatusResponse> | StatusResponse;
|
|
|
|
changePassword(
|
|
request: ChangePasswordRequest,
|
|
metadata?: Metadata,
|
|
): Promise<StatusResponse> | Observable<StatusResponse> | StatusResponse;
|
|
|
|
toggleUserStatus(
|
|
request: ToggleStatusRequest,
|
|
metadata?: Metadata,
|
|
): Promise<StatusResponse> | Observable<StatusResponse> | StatusResponse;
|
|
|
|
/** Управление Группами --- */
|
|
|
|
getGroups(
|
|
request: EmptyRequest,
|
|
metadata?: Metadata,
|
|
): Promise<GroupListResponse> | Observable<GroupListResponse> | GroupListResponse;
|
|
|
|
addUserToGroup(
|
|
request: GroupMemberRequest,
|
|
metadata?: Metadata,
|
|
): Promise<StatusResponse> | Observable<StatusResponse> | StatusResponse;
|
|
|
|
removeUserFromGroup(
|
|
request: GroupMemberRequest,
|
|
metadata?: Metadata,
|
|
): Promise<StatusResponse> | Observable<StatusResponse> | StatusResponse;
|
|
}
|
|
|
|
export function LdapServiceControllerMethods() {
|
|
return function (constructor: Function) {
|
|
const grpcMethods: string[] = [
|
|
"getUsers",
|
|
"createUser",
|
|
"updateUser",
|
|
"changePassword",
|
|
"toggleUserStatus",
|
|
"getGroups",
|
|
"addUserToGroup",
|
|
"removeUserFromGroup",
|
|
];
|
|
for (const method of grpcMethods) {
|
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
GrpcMethod("LdapService", method)(constructor.prototype[method], method, descriptor);
|
|
}
|
|
const grpcStreamMethods: string[] = [];
|
|
for (const method of grpcStreamMethods) {
|
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
GrpcStreamMethod("LdapService", method)(constructor.prototype[method], method, descriptor);
|
|
}
|
|
};
|
|
}
|
|
|
|
export const LDAP_SERVICE_NAME = "LdapService";
|