diff --git a/gen/admin/rbac.ts b/gen/admin/rbac.ts index bcbea3d..e991ad5 100644 --- a/gen/admin/rbac.ts +++ b/gen/admin/rbac.ts @@ -104,6 +104,11 @@ export interface GetUserRolesResponse { maxRoleLevel: number; } +export interface AssignRolesByNameRequest { + userId: string; + roles: string[]; +} + export interface AssignRoleToUserRequest { userId: string; roleId: number; @@ -136,6 +141,8 @@ export interface RbacServiceClient { getAllRoles(request: GetAllRolesRequest, metadata?: Metadata): Observable; + assignRolesByName(request: AssignRolesByNameRequest, metadata?: Metadata): Observable; + getUserRolesAndPermissions(request: GetUserRolesRequest, metadata?: Metadata): Observable; assignRoleToUser(request: AssignRoleToUserRequest, metadata?: Metadata): Observable; @@ -181,6 +188,11 @@ export interface RbacServiceController { metadata?: Metadata, ): Promise | Observable | GetAllRolesResponse; + assignRolesByName( + request: AssignRolesByNameRequest, + metadata?: Metadata, + ): Promise | Observable | ModifyRoleResponse; + getUserRolesAndPermissions( request: GetUserRolesRequest, metadata?: Metadata, @@ -212,6 +224,7 @@ export function RbacServiceControllerMethods() { "updatePermission", "getAllPermissions", "getAllRoles", + "assignRolesByName", "getUserRolesAndPermissions", "assignRoleToUser", "revokeRoleFromUser", diff --git a/gen/go/admin/rbac.pb.go b/gen/go/admin/rbac.pb.go index 18d116d..44915a6 100644 --- a/gen/go/admin/rbac.pb.go +++ b/gen/go/admin/rbac.pb.go @@ -925,6 +925,58 @@ func (x *GetUserRolesResponse) GetMaxRoleLevel() int32 { return 0 } +type AssignRolesByNameRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + Roles []string `protobuf:"bytes,2,rep,name=roles,proto3" json:"roles,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AssignRolesByNameRequest) Reset() { + *x = AssignRolesByNameRequest{} + mi := &file_admin_rbac_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AssignRolesByNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AssignRolesByNameRequest) ProtoMessage() {} + +func (x *AssignRolesByNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_admin_rbac_proto_msgTypes[16] + 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 AssignRolesByNameRequest.ProtoReflect.Descriptor instead. +func (*AssignRolesByNameRequest) Descriptor() ([]byte, []int) { + return file_admin_rbac_proto_rawDescGZIP(), []int{16} +} + +func (x *AssignRolesByNameRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *AssignRolesByNameRequest) GetRoles() []string { + if x != nil { + return x.Roles + } + return nil +} + type AssignRoleToUserRequest struct { state protoimpl.MessageState `protogen:"open.v1"` UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` @@ -935,7 +987,7 @@ type AssignRoleToUserRequest struct { func (x *AssignRoleToUserRequest) Reset() { *x = AssignRoleToUserRequest{} - mi := &file_admin_rbac_proto_msgTypes[16] + mi := &file_admin_rbac_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -947,7 +999,7 @@ func (x *AssignRoleToUserRequest) String() string { func (*AssignRoleToUserRequest) ProtoMessage() {} func (x *AssignRoleToUserRequest) ProtoReflect() protoreflect.Message { - mi := &file_admin_rbac_proto_msgTypes[16] + mi := &file_admin_rbac_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -960,7 +1012,7 @@ func (x *AssignRoleToUserRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AssignRoleToUserRequest.ProtoReflect.Descriptor instead. func (*AssignRoleToUserRequest) Descriptor() ([]byte, []int) { - return file_admin_rbac_proto_rawDescGZIP(), []int{16} + return file_admin_rbac_proto_rawDescGZIP(), []int{17} } func (x *AssignRoleToUserRequest) GetUserId() string { @@ -987,7 +1039,7 @@ type RevokeRoleFromUserRequest struct { func (x *RevokeRoleFromUserRequest) Reset() { *x = RevokeRoleFromUserRequest{} - mi := &file_admin_rbac_proto_msgTypes[17] + mi := &file_admin_rbac_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -999,7 +1051,7 @@ func (x *RevokeRoleFromUserRequest) String() string { func (*RevokeRoleFromUserRequest) ProtoMessage() {} func (x *RevokeRoleFromUserRequest) ProtoReflect() protoreflect.Message { - mi := &file_admin_rbac_proto_msgTypes[17] + mi := &file_admin_rbac_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1012,7 +1064,7 @@ func (x *RevokeRoleFromUserRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RevokeRoleFromUserRequest.ProtoReflect.Descriptor instead. func (*RevokeRoleFromUserRequest) Descriptor() ([]byte, []int) { - return file_admin_rbac_proto_rawDescGZIP(), []int{17} + return file_admin_rbac_proto_rawDescGZIP(), []int{18} } func (x *RevokeRoleFromUserRequest) GetUserId() string { @@ -1039,7 +1091,7 @@ type SyncLdapRolesRequest struct { func (x *SyncLdapRolesRequest) Reset() { *x = SyncLdapRolesRequest{} - mi := &file_admin_rbac_proto_msgTypes[18] + mi := &file_admin_rbac_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1051,7 +1103,7 @@ func (x *SyncLdapRolesRequest) String() string { func (*SyncLdapRolesRequest) ProtoMessage() {} func (x *SyncLdapRolesRequest) ProtoReflect() protoreflect.Message { - mi := &file_admin_rbac_proto_msgTypes[18] + mi := &file_admin_rbac_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1064,7 +1116,7 @@ func (x *SyncLdapRolesRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncLdapRolesRequest.ProtoReflect.Descriptor instead. func (*SyncLdapRolesRequest) Descriptor() ([]byte, []int) { - return file_admin_rbac_proto_rawDescGZIP(), []int{18} + return file_admin_rbac_proto_rawDescGZIP(), []int{19} } func (x *SyncLdapRolesRequest) GetUserId() string { @@ -1148,7 +1200,10 @@ const file_admin_rbac_proto_rawDesc = "" + "\x14GetUserRolesResponse\x12\x14\n" + "\x05roles\x18\x01 \x03(\tR\x05roles\x12 \n" + "\vpermissions\x18\x02 \x03(\tR\vpermissions\x12$\n" + - "\x0emax_role_level\x18\x03 \x01(\x05R\fmaxRoleLevel\"K\n" + + "\x0emax_role_level\x18\x03 \x01(\x05R\fmaxRoleLevel\"I\n" + + "\x18AssignRolesByNameRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x14\n" + + "\x05roles\x18\x02 \x03(\tR\x05roles\"K\n" + "\x17AssignRoleToUserRequest\x12\x17\n" + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x17\n" + "\arole_id\x18\x02 \x01(\x05R\x06roleId\"M\n" + @@ -1158,7 +1213,7 @@ const file_admin_rbac_proto_rawDesc = "" + "\x14SyncLdapRolesRequest\x12\x17\n" + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x1f\n" + "\vldap_groups\x18\x02 \x03(\tR\n" + - "ldapGroups2\x8c\a\n" + + "ldapGroups2\xe1\a\n" + "\vRbacService\x12E\n" + "\n" + "CreateRole\x12\x1a.rbac.v1.CreateRoleRequest\x1a\x1b.rbac.v1.ModifyRoleResponse\x12E\n" + @@ -1169,7 +1224,8 @@ const file_admin_rbac_proto_rawDesc = "" + "\x10CreatePermission\x12 .rbac.v1.CreatePermissionRequest\x1a!.rbac.v1.ModifyPermissionResponse\x12W\n" + "\x10UpdatePermission\x12 .rbac.v1.UpdatePermissionRequest\x1a!.rbac.v1.ModifyPermissionResponse\x12Z\n" + "\x11GetAllPermissions\x12!.rbac.v1.GetAllPermissionsRequest\x1a\".rbac.v1.GetAllPermissionsResponse\x12H\n" + - "\vGetAllRoles\x12\x1b.rbac.v1.GetAllRolesRequest\x1a\x1c.rbac.v1.GetAllRolesResponse\x12Y\n" + + "\vGetAllRoles\x12\x1b.rbac.v1.GetAllRolesRequest\x1a\x1c.rbac.v1.GetAllRolesResponse\x12S\n" + + "\x11AssignRolesByName\x12!.rbac.v1.AssignRolesByNameRequest\x1a\x1b.rbac.v1.ModifyRoleResponse\x12Y\n" + "\x1aGetUserRolesAndPermissions\x12\x1c.rbac.v1.GetUserRolesRequest\x1a\x1d.rbac.v1.GetUserRolesResponse\x12Q\n" + "\x10AssignRoleToUser\x12 .rbac.v1.AssignRoleToUserRequest\x1a\x1b.rbac.v1.ModifyRoleResponse\x12U\n" + "\x12RevokeRoleFromUser\x12\".rbac.v1.RevokeRoleFromUserRequest\x1a\x1b.rbac.v1.ModifyRoleResponse\x12K\n" + @@ -1187,7 +1243,7 @@ func file_admin_rbac_proto_rawDescGZIP() []byte { return file_admin_rbac_proto_rawDescData } -var file_admin_rbac_proto_msgTypes = make([]protoimpl.MessageInfo, 19) +var file_admin_rbac_proto_msgTypes = make([]protoimpl.MessageInfo, 20) var file_admin_rbac_proto_goTypes = []any{ (*GetAllPermissionsRequest)(nil), // 0: rbac.v1.GetAllPermissionsRequest (*GetAllPermissionsResponse)(nil), // 1: rbac.v1.GetAllPermissionsResponse @@ -1205,9 +1261,10 @@ var file_admin_rbac_proto_goTypes = []any{ (*Roles)(nil), // 13: rbac.v1.Roles (*GetUserRolesRequest)(nil), // 14: rbac.v1.GetUserRolesRequest (*GetUserRolesResponse)(nil), // 15: rbac.v1.GetUserRolesResponse - (*AssignRoleToUserRequest)(nil), // 16: rbac.v1.AssignRoleToUserRequest - (*RevokeRoleFromUserRequest)(nil), // 17: rbac.v1.RevokeRoleFromUserRequest - (*SyncLdapRolesRequest)(nil), // 18: rbac.v1.SyncLdapRolesRequest + (*AssignRolesByNameRequest)(nil), // 16: rbac.v1.AssignRolesByNameRequest + (*AssignRoleToUserRequest)(nil), // 17: rbac.v1.AssignRoleToUserRequest + (*RevokeRoleFromUserRequest)(nil), // 18: rbac.v1.RevokeRoleFromUserRequest + (*SyncLdapRolesRequest)(nil), // 19: rbac.v1.SyncLdapRolesRequest } var file_admin_rbac_proto_depIdxs = []int32{ 2, // 0: rbac.v1.GetAllPermissionsResponse.permissions:type_name -> rbac.v1.Permission @@ -1219,23 +1276,25 @@ var file_admin_rbac_proto_depIdxs = []int32{ 11, // 6: rbac.v1.RbacService.UpdatePermission:input_type -> rbac.v1.UpdatePermissionRequest 0, // 7: rbac.v1.RbacService.GetAllPermissions:input_type -> rbac.v1.GetAllPermissionsRequest 3, // 8: rbac.v1.RbacService.GetAllRoles:input_type -> rbac.v1.GetAllRolesRequest - 14, // 9: rbac.v1.RbacService.GetUserRolesAndPermissions:input_type -> rbac.v1.GetUserRolesRequest - 16, // 10: rbac.v1.RbacService.AssignRoleToUser:input_type -> rbac.v1.AssignRoleToUserRequest - 17, // 11: rbac.v1.RbacService.RevokeRoleFromUser:input_type -> rbac.v1.RevokeRoleFromUserRequest - 18, // 12: rbac.v1.RbacService.SyncLdapRoles:input_type -> rbac.v1.SyncLdapRolesRequest - 7, // 13: rbac.v1.RbacService.CreateRole:output_type -> rbac.v1.ModifyRoleResponse - 7, // 14: rbac.v1.RbacService.UpdateRole:output_type -> rbac.v1.ModifyRoleResponse - 9, // 15: rbac.v1.RbacService.DeleteRole:output_type -> rbac.v1.DeleteRoleResponse - 12, // 16: rbac.v1.RbacService.CreatePermission:output_type -> rbac.v1.ModifyPermissionResponse - 12, // 17: rbac.v1.RbacService.UpdatePermission:output_type -> rbac.v1.ModifyPermissionResponse - 1, // 18: rbac.v1.RbacService.GetAllPermissions:output_type -> rbac.v1.GetAllPermissionsResponse - 4, // 19: rbac.v1.RbacService.GetAllRoles:output_type -> rbac.v1.GetAllRolesResponse - 15, // 20: rbac.v1.RbacService.GetUserRolesAndPermissions:output_type -> rbac.v1.GetUserRolesResponse - 7, // 21: rbac.v1.RbacService.AssignRoleToUser:output_type -> rbac.v1.ModifyRoleResponse - 7, // 22: rbac.v1.RbacService.RevokeRoleFromUser:output_type -> rbac.v1.ModifyRoleResponse - 7, // 23: rbac.v1.RbacService.SyncLdapRoles:output_type -> rbac.v1.ModifyRoleResponse - 13, // [13:24] is the sub-list for method output_type - 2, // [2:13] is the sub-list for method input_type + 16, // 9: rbac.v1.RbacService.AssignRolesByName:input_type -> rbac.v1.AssignRolesByNameRequest + 14, // 10: rbac.v1.RbacService.GetUserRolesAndPermissions:input_type -> rbac.v1.GetUserRolesRequest + 17, // 11: rbac.v1.RbacService.AssignRoleToUser:input_type -> rbac.v1.AssignRoleToUserRequest + 18, // 12: rbac.v1.RbacService.RevokeRoleFromUser:input_type -> rbac.v1.RevokeRoleFromUserRequest + 19, // 13: rbac.v1.RbacService.SyncLdapRoles:input_type -> rbac.v1.SyncLdapRolesRequest + 7, // 14: rbac.v1.RbacService.CreateRole:output_type -> rbac.v1.ModifyRoleResponse + 7, // 15: rbac.v1.RbacService.UpdateRole:output_type -> rbac.v1.ModifyRoleResponse + 9, // 16: rbac.v1.RbacService.DeleteRole:output_type -> rbac.v1.DeleteRoleResponse + 12, // 17: rbac.v1.RbacService.CreatePermission:output_type -> rbac.v1.ModifyPermissionResponse + 12, // 18: rbac.v1.RbacService.UpdatePermission:output_type -> rbac.v1.ModifyPermissionResponse + 1, // 19: rbac.v1.RbacService.GetAllPermissions:output_type -> rbac.v1.GetAllPermissionsResponse + 4, // 20: rbac.v1.RbacService.GetAllRoles:output_type -> rbac.v1.GetAllRolesResponse + 7, // 21: rbac.v1.RbacService.AssignRolesByName:output_type -> rbac.v1.ModifyRoleResponse + 15, // 22: rbac.v1.RbacService.GetUserRolesAndPermissions:output_type -> rbac.v1.GetUserRolesResponse + 7, // 23: rbac.v1.RbacService.AssignRoleToUser:output_type -> rbac.v1.ModifyRoleResponse + 7, // 24: rbac.v1.RbacService.RevokeRoleFromUser:output_type -> rbac.v1.ModifyRoleResponse + 7, // 25: rbac.v1.RbacService.SyncLdapRoles:output_type -> rbac.v1.ModifyRoleResponse + 14, // [14:26] is the sub-list for method output_type + 2, // [2:14] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension extendee 0, // [0:2] is the sub-list for field type_name @@ -1254,7 +1313,7 @@ func file_admin_rbac_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_admin_rbac_proto_rawDesc), len(file_admin_rbac_proto_rawDesc)), NumEnums: 0, - NumMessages: 19, + NumMessages: 20, NumExtensions: 0, NumServices: 1, }, diff --git a/gen/go/admin/rbac_grpc.pb.go b/gen/go/admin/rbac_grpc.pb.go index 65176be..8b3abb5 100644 --- a/gen/go/admin/rbac_grpc.pb.go +++ b/gen/go/admin/rbac_grpc.pb.go @@ -26,6 +26,7 @@ const ( RbacService_UpdatePermission_FullMethodName = "/rbac.v1.RbacService/UpdatePermission" RbacService_GetAllPermissions_FullMethodName = "/rbac.v1.RbacService/GetAllPermissions" RbacService_GetAllRoles_FullMethodName = "/rbac.v1.RbacService/GetAllRoles" + RbacService_AssignRolesByName_FullMethodName = "/rbac.v1.RbacService/AssignRolesByName" RbacService_GetUserRolesAndPermissions_FullMethodName = "/rbac.v1.RbacService/GetUserRolesAndPermissions" RbacService_AssignRoleToUser_FullMethodName = "/rbac.v1.RbacService/AssignRoleToUser" RbacService_RevokeRoleFromUser_FullMethodName = "/rbac.v1.RbacService/RevokeRoleFromUser" @@ -43,6 +44,7 @@ type RbacServiceClient interface { UpdatePermission(ctx context.Context, in *UpdatePermissionRequest, opts ...grpc.CallOption) (*ModifyPermissionResponse, error) GetAllPermissions(ctx context.Context, in *GetAllPermissionsRequest, opts ...grpc.CallOption) (*GetAllPermissionsResponse, error) GetAllRoles(ctx context.Context, in *GetAllRolesRequest, opts ...grpc.CallOption) (*GetAllRolesResponse, error) + AssignRolesByName(ctx context.Context, in *AssignRolesByNameRequest, opts ...grpc.CallOption) (*ModifyRoleResponse, error) GetUserRolesAndPermissions(ctx context.Context, in *GetUserRolesRequest, opts ...grpc.CallOption) (*GetUserRolesResponse, error) AssignRoleToUser(ctx context.Context, in *AssignRoleToUserRequest, opts ...grpc.CallOption) (*ModifyRoleResponse, error) RevokeRoleFromUser(ctx context.Context, in *RevokeRoleFromUserRequest, opts ...grpc.CallOption) (*ModifyRoleResponse, error) @@ -127,6 +129,16 @@ func (c *rbacServiceClient) GetAllRoles(ctx context.Context, in *GetAllRolesRequ return out, nil } +func (c *rbacServiceClient) AssignRolesByName(ctx context.Context, in *AssignRolesByNameRequest, opts ...grpc.CallOption) (*ModifyRoleResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ModifyRoleResponse) + err := c.cc.Invoke(ctx, RbacService_AssignRolesByName_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *rbacServiceClient) GetUserRolesAndPermissions(ctx context.Context, in *GetUserRolesRequest, opts ...grpc.CallOption) (*GetUserRolesResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(GetUserRolesResponse) @@ -178,6 +190,7 @@ type RbacServiceServer interface { UpdatePermission(context.Context, *UpdatePermissionRequest) (*ModifyPermissionResponse, error) GetAllPermissions(context.Context, *GetAllPermissionsRequest) (*GetAllPermissionsResponse, error) GetAllRoles(context.Context, *GetAllRolesRequest) (*GetAllRolesResponse, error) + AssignRolesByName(context.Context, *AssignRolesByNameRequest) (*ModifyRoleResponse, error) GetUserRolesAndPermissions(context.Context, *GetUserRolesRequest) (*GetUserRolesResponse, error) AssignRoleToUser(context.Context, *AssignRoleToUserRequest) (*ModifyRoleResponse, error) RevokeRoleFromUser(context.Context, *RevokeRoleFromUserRequest) (*ModifyRoleResponse, error) @@ -213,6 +226,9 @@ func (UnimplementedRbacServiceServer) GetAllPermissions(context.Context, *GetAll func (UnimplementedRbacServiceServer) GetAllRoles(context.Context, *GetAllRolesRequest) (*GetAllRolesResponse, error) { return nil, status.Error(codes.Unimplemented, "method GetAllRoles not implemented") } +func (UnimplementedRbacServiceServer) AssignRolesByName(context.Context, *AssignRolesByNameRequest) (*ModifyRoleResponse, error) { + return nil, status.Error(codes.Unimplemented, "method AssignRolesByName not implemented") +} func (UnimplementedRbacServiceServer) GetUserRolesAndPermissions(context.Context, *GetUserRolesRequest) (*GetUserRolesResponse, error) { return nil, status.Error(codes.Unimplemented, "method GetUserRolesAndPermissions not implemented") } @@ -372,6 +388,24 @@ func _RbacService_GetAllRoles_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _RbacService_AssignRolesByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AssignRolesByNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RbacServiceServer).AssignRolesByName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RbacService_AssignRolesByName_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RbacServiceServer).AssignRolesByName(ctx, req.(*AssignRolesByNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _RbacService_GetUserRolesAndPermissions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetUserRolesRequest) if err := dec(in); err != nil { @@ -479,6 +513,10 @@ var RbacService_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetAllRoles", Handler: _RbacService_GetAllRoles_Handler, }, + { + MethodName: "AssignRolesByName", + Handler: _RbacService_AssignRolesByName_Handler, + }, { MethodName: "GetUserRolesAndPermissions", Handler: _RbacService_GetUserRolesAndPermissions_Handler, diff --git a/gen/go/users/users.pb.go b/gen/go/users/users.pb.go index af5feaa..e1387fa 100644 --- a/gen/go/users/users.pb.go +++ b/gen/go/users/users.pb.go @@ -470,6 +470,94 @@ func (x *CreateProfileResponse) GetSuccess() bool { return false } +type SoftDeleteProfileRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SoftDeleteProfileRequest) Reset() { + *x = SoftDeleteProfileRequest{} + mi := &file_users_users_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SoftDeleteProfileRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SoftDeleteProfileRequest) ProtoMessage() {} + +func (x *SoftDeleteProfileRequest) ProtoReflect() protoreflect.Message { + mi := &file_users_users_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 SoftDeleteProfileRequest.ProtoReflect.Descriptor instead. +func (*SoftDeleteProfileRequest) Descriptor() ([]byte, []int) { + return file_users_users_proto_rawDescGZIP(), []int{6} +} + +func (x *SoftDeleteProfileRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type SoftDeleteProfileResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SoftDeleteProfileResponse) Reset() { + *x = SoftDeleteProfileResponse{} + mi := &file_users_users_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SoftDeleteProfileResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SoftDeleteProfileResponse) ProtoMessage() {} + +func (x *SoftDeleteProfileResponse) ProtoReflect() protoreflect.Message { + mi := &file_users_users_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 SoftDeleteProfileResponse.ProtoReflect.Descriptor instead. +func (*SoftDeleteProfileResponse) Descriptor() ([]byte, []int) { + return file_users_users_proto_rawDescGZIP(), []int{7} +} + +func (x *SoftDeleteProfileResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + var File_users_users_proto protoreflect.FileDescriptor const file_users_users_proto_rawDesc = "" + @@ -537,12 +625,17 @@ const file_users_users_proto_rawDesc = "" + "\x06_phoneB\r\n" + "\v_avatar_url\"1\n" + "\x15CreateProfileResponse\x12\x18\n" + - "\asuccess\x18\x01 \x01(\bR\asuccess2\xfb\x01\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\"3\n" + + "\x18SoftDeleteProfileRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\"5\n" + + "\x19SoftDeleteProfileResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess2\xd9\x02\n" + "\fUsersService\x12G\n" + "\n" + "GetProfile\x12\x1b.users.v1.GetProfileRequest\x1a\x1c.users.v1.GetProfileResponse\x12P\n" + "\rUpdateProfile\x12\x1e.users.v1.UpdateProfileRequest\x1a\x1f.users.v1.UpdateProfileResponse\x12P\n" + - "\rCreateProfile\x12\x1e.users.v1.CreateProfileRequest\x1a\x1f.users.v1.CreateProfileResponseB*Z(git.lendry.ru/lendry-erp/proto.git/go;pbb\x06proto3" + "\rCreateProfile\x12\x1e.users.v1.CreateProfileRequest\x1a\x1f.users.v1.CreateProfileResponse\x12\\\n" + + "\x11SoftDeleteProfile\x12\".users.v1.SoftDeleteProfileRequest\x1a#.users.v1.SoftDeleteProfileResponseB*Z(git.lendry.ru/lendry-erp/proto.git/go;pbb\x06proto3" var ( file_users_users_proto_rawDescOnce sync.Once @@ -556,24 +649,28 @@ func file_users_users_proto_rawDescGZIP() []byte { return file_users_users_proto_rawDescData } -var file_users_users_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_users_users_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_users_users_proto_goTypes = []any{ - (*GetProfileRequest)(nil), // 0: users.v1.GetProfileRequest - (*GetProfileResponse)(nil), // 1: users.v1.GetProfileResponse - (*UpdateProfileRequest)(nil), // 2: users.v1.UpdateProfileRequest - (*UpdateProfileResponse)(nil), // 3: users.v1.UpdateProfileResponse - (*CreateProfileRequest)(nil), // 4: users.v1.CreateProfileRequest - (*CreateProfileResponse)(nil), // 5: users.v1.CreateProfileResponse + (*GetProfileRequest)(nil), // 0: users.v1.GetProfileRequest + (*GetProfileResponse)(nil), // 1: users.v1.GetProfileResponse + (*UpdateProfileRequest)(nil), // 2: users.v1.UpdateProfileRequest + (*UpdateProfileResponse)(nil), // 3: users.v1.UpdateProfileResponse + (*CreateProfileRequest)(nil), // 4: users.v1.CreateProfileRequest + (*CreateProfileResponse)(nil), // 5: users.v1.CreateProfileResponse + (*SoftDeleteProfileRequest)(nil), // 6: users.v1.SoftDeleteProfileRequest + (*SoftDeleteProfileResponse)(nil), // 7: users.v1.SoftDeleteProfileResponse } var file_users_users_proto_depIdxs = []int32{ 0, // 0: users.v1.UsersService.GetProfile:input_type -> users.v1.GetProfileRequest 2, // 1: users.v1.UsersService.UpdateProfile:input_type -> users.v1.UpdateProfileRequest 4, // 2: users.v1.UsersService.CreateProfile:input_type -> users.v1.CreateProfileRequest - 1, // 3: users.v1.UsersService.GetProfile:output_type -> users.v1.GetProfileResponse - 3, // 4: users.v1.UsersService.UpdateProfile:output_type -> users.v1.UpdateProfileResponse - 5, // 5: users.v1.UsersService.CreateProfile:output_type -> users.v1.CreateProfileResponse - 3, // [3:6] is the sub-list for method output_type - 0, // [0:3] is the sub-list for method input_type + 6, // 3: users.v1.UsersService.SoftDeleteProfile:input_type -> users.v1.SoftDeleteProfileRequest + 1, // 4: users.v1.UsersService.GetProfile:output_type -> users.v1.GetProfileResponse + 3, // 5: users.v1.UsersService.UpdateProfile:output_type -> users.v1.UpdateProfileResponse + 5, // 6: users.v1.UsersService.CreateProfile:output_type -> users.v1.CreateProfileResponse + 7, // 7: users.v1.UsersService.SoftDeleteProfile:output_type -> users.v1.SoftDeleteProfileResponse + 4, // [4:8] is the sub-list for method output_type + 0, // [0:4] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name @@ -593,7 +690,7 @@ func file_users_users_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_users_users_proto_rawDesc), len(file_users_users_proto_rawDesc)), NumEnums: 0, - NumMessages: 6, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, diff --git a/gen/go/users/users_grpc.pb.go b/gen/go/users/users_grpc.pb.go index cd4cdc2..8c86518 100644 --- a/gen/go/users/users_grpc.pb.go +++ b/gen/go/users/users_grpc.pb.go @@ -19,9 +19,10 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - UsersService_GetProfile_FullMethodName = "/users.v1.UsersService/GetProfile" - UsersService_UpdateProfile_FullMethodName = "/users.v1.UsersService/UpdateProfile" - UsersService_CreateProfile_FullMethodName = "/users.v1.UsersService/CreateProfile" + UsersService_GetProfile_FullMethodName = "/users.v1.UsersService/GetProfile" + UsersService_UpdateProfile_FullMethodName = "/users.v1.UsersService/UpdateProfile" + UsersService_CreateProfile_FullMethodName = "/users.v1.UsersService/CreateProfile" + UsersService_SoftDeleteProfile_FullMethodName = "/users.v1.UsersService/SoftDeleteProfile" ) // UsersServiceClient is the client API for UsersService service. @@ -32,6 +33,7 @@ type UsersServiceClient interface { UpdateProfile(ctx context.Context, in *UpdateProfileRequest, opts ...grpc.CallOption) (*UpdateProfileResponse, error) // Для системного использования (вызывается из Auth/Admin) CreateProfile(ctx context.Context, in *CreateProfileRequest, opts ...grpc.CallOption) (*CreateProfileResponse, error) + SoftDeleteProfile(ctx context.Context, in *SoftDeleteProfileRequest, opts ...grpc.CallOption) (*SoftDeleteProfileResponse, error) } type usersServiceClient struct { @@ -72,6 +74,16 @@ func (c *usersServiceClient) CreateProfile(ctx context.Context, in *CreateProfil return out, nil } +func (c *usersServiceClient) SoftDeleteProfile(ctx context.Context, in *SoftDeleteProfileRequest, opts ...grpc.CallOption) (*SoftDeleteProfileResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SoftDeleteProfileResponse) + err := c.cc.Invoke(ctx, UsersService_SoftDeleteProfile_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // UsersServiceServer is the server API for UsersService service. // All implementations must embed UnimplementedUsersServiceServer // for forward compatibility. @@ -80,6 +92,7 @@ type UsersServiceServer interface { UpdateProfile(context.Context, *UpdateProfileRequest) (*UpdateProfileResponse, error) // Для системного использования (вызывается из Auth/Admin) CreateProfile(context.Context, *CreateProfileRequest) (*CreateProfileResponse, error) + SoftDeleteProfile(context.Context, *SoftDeleteProfileRequest) (*SoftDeleteProfileResponse, error) mustEmbedUnimplementedUsersServiceServer() } @@ -99,6 +112,9 @@ func (UnimplementedUsersServiceServer) UpdateProfile(context.Context, *UpdatePro func (UnimplementedUsersServiceServer) CreateProfile(context.Context, *CreateProfileRequest) (*CreateProfileResponse, error) { return nil, status.Error(codes.Unimplemented, "method CreateProfile not implemented") } +func (UnimplementedUsersServiceServer) SoftDeleteProfile(context.Context, *SoftDeleteProfileRequest) (*SoftDeleteProfileResponse, error) { + return nil, status.Error(codes.Unimplemented, "method SoftDeleteProfile not implemented") +} func (UnimplementedUsersServiceServer) mustEmbedUnimplementedUsersServiceServer() {} func (UnimplementedUsersServiceServer) testEmbeddedByValue() {} @@ -174,6 +190,24 @@ func _UsersService_CreateProfile_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } +func _UsersService_SoftDeleteProfile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SoftDeleteProfileRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UsersServiceServer).SoftDeleteProfile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UsersService_SoftDeleteProfile_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UsersServiceServer).SoftDeleteProfile(ctx, req.(*SoftDeleteProfileRequest)) + } + return interceptor(ctx, in, info, handler) +} + // UsersService_ServiceDesc is the grpc.ServiceDesc for UsersService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -193,6 +227,10 @@ var UsersService_ServiceDesc = grpc.ServiceDesc{ MethodName: "CreateProfile", Handler: _UsersService_CreateProfile_Handler, }, + { + MethodName: "SoftDeleteProfile", + Handler: _UsersService_SoftDeleteProfile_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "users/users.proto", diff --git a/gen/users/users.ts b/gen/users/users.ts index ce54ce0..ea80386 100644 --- a/gen/users/users.ts +++ b/gen/users/users.ts @@ -61,6 +61,14 @@ export interface CreateProfileResponse { success: boolean; } +export interface SoftDeleteProfileRequest { + userId: string; +} + +export interface SoftDeleteProfileResponse { + success: boolean; +} + export const USERS_V1_PACKAGE_NAME = "users.v1"; export interface UsersServiceClient { @@ -71,6 +79,8 @@ export interface UsersServiceClient { /** Для системного использования (вызывается из Auth/Admin) */ createProfile(request: CreateProfileRequest, metadata?: Metadata): Observable; + + softDeleteProfile(request: SoftDeleteProfileRequest, metadata?: Metadata): Observable; } export interface UsersServiceController { @@ -90,11 +100,16 @@ export interface UsersServiceController { request: CreateProfileRequest, metadata?: Metadata, ): Promise | Observable | CreateProfileResponse; + + softDeleteProfile( + request: SoftDeleteProfileRequest, + metadata?: Metadata, + ): Promise | Observable | SoftDeleteProfileResponse; } export function UsersServiceControllerMethods() { return function (constructor: Function) { - const grpcMethods: string[] = ["getProfile", "updateProfile", "createProfile"]; + const grpcMethods: string[] = ["getProfile", "updateProfile", "createProfile", "softDeleteProfile"]; for (const method of grpcMethods) { const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); GrpcMethod("UsersService", method)(constructor.prototype[method], method, descriptor);