From 6b1d534b6580f3299bc5e85ef6b44d5f799c3e5a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 9 Apr 2026 14:06:47 +0000 Subject: [PATCH] chore: auto-generate protobuf files [skip ci] --- gen/account.ts | 37 +++ gen/go/account.pb.go | 354 +++++++++++++++++++----- gen/go/account_grpc.pb.go | 76 ++++++ gen/go/rbac.pb.go | 547 ++++++++++++++++++++++++++++++++++++-- gen/go/rbac_grpc.pb.go | 190 +++++++++++++ gen/rbac.ts | 90 ++++++- 6 files changed, 1212 insertions(+), 82 deletions(-) diff --git a/gen/account.ts b/gen/account.ts index a6332a1..3f82113 100644 --- a/gen/account.ts +++ b/gen/account.ts @@ -87,6 +87,27 @@ export interface ChangeDataResponse { message: string; } +export interface AssignRoleRequest { + userId: string; + /** В gRPC передаем как string, внутри преобразуем в Int */ + roleId: string; +} + +export interface AssignRoleResponse { + success: boolean; + message: string; +} + +export interface RevokeRoleRequest { + userId: string; + roleId: string; +} + +export interface RevokeRoleResponse { + success: boolean; + message: string; +} + export interface AdminResetPasswordRequest { userId: string; newPassword: string; @@ -156,6 +177,10 @@ export interface AccountServiceClient { changeData(request: ChangeDataRequest, metadata?: Metadata): Observable; + assignRole(request: AssignRoleRequest, metadata?: Metadata): Observable; + + revokeRole(request: RevokeRoleRequest, metadata?: Metadata): Observable; + setPin(request: SetPinRequest, metadata?: Metadata): Observable; unlockPin(request: UnlockPinRequest, metadata?: Metadata): Observable; @@ -196,6 +221,16 @@ export interface AccountServiceController { metadata?: Metadata, ): Promise | Observable | ChangeDataResponse; + assignRole( + request: AssignRoleRequest, + metadata?: Metadata, + ): Promise | Observable | AssignRoleResponse; + + revokeRole( + request: RevokeRoleRequest, + metadata?: Metadata, + ): Promise | Observable | RevokeRoleResponse; + setPin( request: SetPinRequest, metadata?: Metadata, @@ -226,6 +261,8 @@ export function AccountServiceControllerMethods() { "createUser", "deleteUser", "changeData", + "assignRole", + "revokeRole", "setPin", "unlockPin", "getPinStatus", diff --git a/gen/go/account.pb.go b/gen/go/account.pb.go index 429dbb7..3a4fa24 100644 --- a/gen/go/account.pb.go +++ b/gen/go/account.pb.go @@ -749,6 +749,214 @@ func (x *ChangeDataResponse) GetMessage() string { return "" } +type AssignRoleRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + RoleId string `protobuf:"bytes,2,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` // В gRPC передаем как string, внутри преобразуем в Int + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AssignRoleRequest) Reset() { + *x = AssignRoleRequest{} + mi := &file_account_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AssignRoleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AssignRoleRequest) ProtoMessage() {} + +func (x *AssignRoleRequest) ProtoReflect() protoreflect.Message { + mi := &file_account_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 AssignRoleRequest.ProtoReflect.Descriptor instead. +func (*AssignRoleRequest) Descriptor() ([]byte, []int) { + return file_account_proto_rawDescGZIP(), []int{10} +} + +func (x *AssignRoleRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *AssignRoleRequest) GetRoleId() string { + if x != nil { + return x.RoleId + } + return "" +} + +type AssignRoleResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AssignRoleResponse) Reset() { + *x = AssignRoleResponse{} + mi := &file_account_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AssignRoleResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AssignRoleResponse) ProtoMessage() {} + +func (x *AssignRoleResponse) ProtoReflect() protoreflect.Message { + mi := &file_account_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 AssignRoleResponse.ProtoReflect.Descriptor instead. +func (*AssignRoleResponse) Descriptor() ([]byte, []int) { + return file_account_proto_rawDescGZIP(), []int{11} +} + +func (x *AssignRoleResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *AssignRoleResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type RevokeRoleRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + RoleId string `protobuf:"bytes,2,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RevokeRoleRequest) Reset() { + *x = RevokeRoleRequest{} + mi := &file_account_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RevokeRoleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RevokeRoleRequest) ProtoMessage() {} + +func (x *RevokeRoleRequest) ProtoReflect() protoreflect.Message { + mi := &file_account_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 RevokeRoleRequest.ProtoReflect.Descriptor instead. +func (*RevokeRoleRequest) Descriptor() ([]byte, []int) { + return file_account_proto_rawDescGZIP(), []int{12} +} + +func (x *RevokeRoleRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *RevokeRoleRequest) GetRoleId() string { + if x != nil { + return x.RoleId + } + return "" +} + +type RevokeRoleResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RevokeRoleResponse) Reset() { + *x = RevokeRoleResponse{} + mi := &file_account_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RevokeRoleResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RevokeRoleResponse) ProtoMessage() {} + +func (x *RevokeRoleResponse) ProtoReflect() protoreflect.Message { + mi := &file_account_proto_msgTypes[13] + 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 RevokeRoleResponse.ProtoReflect.Descriptor instead. +func (*RevokeRoleResponse) Descriptor() ([]byte, []int) { + return file_account_proto_rawDescGZIP(), []int{13} +} + +func (x *RevokeRoleResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *RevokeRoleResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + type AdminResetPasswordRequest struct { state protoimpl.MessageState `protogen:"open.v1"` UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` @@ -759,7 +967,7 @@ type AdminResetPasswordRequest struct { func (x *AdminResetPasswordRequest) Reset() { *x = AdminResetPasswordRequest{} - mi := &file_account_proto_msgTypes[10] + mi := &file_account_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -771,7 +979,7 @@ func (x *AdminResetPasswordRequest) String() string { func (*AdminResetPasswordRequest) ProtoMessage() {} func (x *AdminResetPasswordRequest) ProtoReflect() protoreflect.Message { - mi := &file_account_proto_msgTypes[10] + mi := &file_account_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -784,7 +992,7 @@ func (x *AdminResetPasswordRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AdminResetPasswordRequest.ProtoReflect.Descriptor instead. func (*AdminResetPasswordRequest) Descriptor() ([]byte, []int) { - return file_account_proto_rawDescGZIP(), []int{10} + return file_account_proto_rawDescGZIP(), []int{14} } func (x *AdminResetPasswordRequest) GetUserId() string { @@ -811,7 +1019,7 @@ type AdminResetPasswordResponse struct { func (x *AdminResetPasswordResponse) Reset() { *x = AdminResetPasswordResponse{} - mi := &file_account_proto_msgTypes[11] + mi := &file_account_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -823,7 +1031,7 @@ func (x *AdminResetPasswordResponse) String() string { func (*AdminResetPasswordResponse) ProtoMessage() {} func (x *AdminResetPasswordResponse) ProtoReflect() protoreflect.Message { - mi := &file_account_proto_msgTypes[11] + mi := &file_account_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -836,7 +1044,7 @@ func (x *AdminResetPasswordResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AdminResetPasswordResponse.ProtoReflect.Descriptor instead. func (*AdminResetPasswordResponse) Descriptor() ([]byte, []int) { - return file_account_proto_rawDescGZIP(), []int{11} + return file_account_proto_rawDescGZIP(), []int{15} } func (x *AdminResetPasswordResponse) GetSuccess() bool { @@ -864,7 +1072,7 @@ type SetPinRequest struct { func (x *SetPinRequest) Reset() { *x = SetPinRequest{} - mi := &file_account_proto_msgTypes[12] + mi := &file_account_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -876,7 +1084,7 @@ func (x *SetPinRequest) String() string { func (*SetPinRequest) ProtoMessage() {} func (x *SetPinRequest) ProtoReflect() protoreflect.Message { - mi := &file_account_proto_msgTypes[12] + mi := &file_account_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -889,7 +1097,7 @@ func (x *SetPinRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SetPinRequest.ProtoReflect.Descriptor instead. func (*SetPinRequest) Descriptor() ([]byte, []int) { - return file_account_proto_rawDescGZIP(), []int{12} + return file_account_proto_rawDescGZIP(), []int{16} } func (x *SetPinRequest) GetUserId() string { @@ -923,7 +1131,7 @@ type SetPinResponse struct { func (x *SetPinResponse) Reset() { *x = SetPinResponse{} - mi := &file_account_proto_msgTypes[13] + mi := &file_account_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -935,7 +1143,7 @@ func (x *SetPinResponse) String() string { func (*SetPinResponse) ProtoMessage() {} func (x *SetPinResponse) ProtoReflect() protoreflect.Message { - mi := &file_account_proto_msgTypes[13] + mi := &file_account_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -948,7 +1156,7 @@ func (x *SetPinResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SetPinResponse.ProtoReflect.Descriptor instead. func (*SetPinResponse) Descriptor() ([]byte, []int) { - return file_account_proto_rawDescGZIP(), []int{13} + return file_account_proto_rawDescGZIP(), []int{17} } func (x *SetPinResponse) GetSuccess() bool { @@ -976,7 +1184,7 @@ type UnlockPinRequest struct { func (x *UnlockPinRequest) Reset() { *x = UnlockPinRequest{} - mi := &file_account_proto_msgTypes[14] + mi := &file_account_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -988,7 +1196,7 @@ func (x *UnlockPinRequest) String() string { func (*UnlockPinRequest) ProtoMessage() {} func (x *UnlockPinRequest) ProtoReflect() protoreflect.Message { - mi := &file_account_proto_msgTypes[14] + mi := &file_account_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1001,7 +1209,7 @@ func (x *UnlockPinRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UnlockPinRequest.ProtoReflect.Descriptor instead. func (*UnlockPinRequest) Descriptor() ([]byte, []int) { - return file_account_proto_rawDescGZIP(), []int{14} + return file_account_proto_rawDescGZIP(), []int{18} } func (x *UnlockPinRequest) GetUserId() string { @@ -1035,7 +1243,7 @@ type UnlockPinResponse struct { func (x *UnlockPinResponse) Reset() { *x = UnlockPinResponse{} - mi := &file_account_proto_msgTypes[15] + mi := &file_account_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1047,7 +1255,7 @@ func (x *UnlockPinResponse) String() string { func (*UnlockPinResponse) ProtoMessage() {} func (x *UnlockPinResponse) ProtoReflect() protoreflect.Message { - mi := &file_account_proto_msgTypes[15] + mi := &file_account_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1060,7 +1268,7 @@ func (x *UnlockPinResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use UnlockPinResponse.ProtoReflect.Descriptor instead. func (*UnlockPinResponse) Descriptor() ([]byte, []int) { - return file_account_proto_rawDescGZIP(), []int{15} + return file_account_proto_rawDescGZIP(), []int{19} } func (x *UnlockPinResponse) GetSuccess() bool { @@ -1087,7 +1295,7 @@ type GetPinStatusRequest struct { func (x *GetPinStatusRequest) Reset() { *x = GetPinStatusRequest{} - mi := &file_account_proto_msgTypes[16] + mi := &file_account_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1099,7 +1307,7 @@ func (x *GetPinStatusRequest) String() string { func (*GetPinStatusRequest) ProtoMessage() {} func (x *GetPinStatusRequest) ProtoReflect() protoreflect.Message { - mi := &file_account_proto_msgTypes[16] + mi := &file_account_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1112,7 +1320,7 @@ func (x *GetPinStatusRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetPinStatusRequest.ProtoReflect.Descriptor instead. func (*GetPinStatusRequest) Descriptor() ([]byte, []int) { - return file_account_proto_rawDescGZIP(), []int{16} + return file_account_proto_rawDescGZIP(), []int{20} } func (x *GetPinStatusRequest) GetUserId() string { @@ -1140,7 +1348,7 @@ type GetPinStatusResponse struct { func (x *GetPinStatusResponse) Reset() { *x = GetPinStatusResponse{} - mi := &file_account_proto_msgTypes[17] + mi := &file_account_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1152,7 +1360,7 @@ func (x *GetPinStatusResponse) String() string { func (*GetPinStatusResponse) ProtoMessage() {} func (x *GetPinStatusResponse) ProtoReflect() protoreflect.Message { - mi := &file_account_proto_msgTypes[17] + mi := &file_account_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1165,7 +1373,7 @@ func (x *GetPinStatusResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetPinStatusResponse.ProtoReflect.Descriptor instead. func (*GetPinStatusResponse) Descriptor() ([]byte, []int) { - return file_account_proto_rawDescGZIP(), []int{17} + return file_account_proto_rawDescGZIP(), []int{21} } func (x *GetPinStatusResponse) GetHasPin() bool { @@ -1200,7 +1408,7 @@ type RemovePinRequest struct { func (x *RemovePinRequest) Reset() { *x = RemovePinRequest{} - mi := &file_account_proto_msgTypes[18] + mi := &file_account_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1212,7 +1420,7 @@ func (x *RemovePinRequest) String() string { func (*RemovePinRequest) ProtoMessage() {} func (x *RemovePinRequest) ProtoReflect() protoreflect.Message { - mi := &file_account_proto_msgTypes[18] + mi := &file_account_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1225,7 +1433,7 @@ func (x *RemovePinRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RemovePinRequest.ProtoReflect.Descriptor instead. func (*RemovePinRequest) Descriptor() ([]byte, []int) { - return file_account_proto_rawDescGZIP(), []int{18} + return file_account_proto_rawDescGZIP(), []int{22} } func (x *RemovePinRequest) GetPin() string { @@ -1259,7 +1467,7 @@ type RemovePinResponse struct { func (x *RemovePinResponse) Reset() { *x = RemovePinResponse{} - mi := &file_account_proto_msgTypes[19] + mi := &file_account_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1271,7 +1479,7 @@ func (x *RemovePinResponse) String() string { func (*RemovePinResponse) ProtoMessage() {} func (x *RemovePinResponse) ProtoReflect() protoreflect.Message { - mi := &file_account_proto_msgTypes[19] + mi := &file_account_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1284,7 +1492,7 @@ func (x *RemovePinResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RemovePinResponse.ProtoReflect.Descriptor instead. func (*RemovePinResponse) Descriptor() ([]byte, []int) { - return file_account_proto_rawDescGZIP(), []int{19} + return file_account_proto_rawDescGZIP(), []int{23} } func (x *RemovePinResponse) GetSuccess() bool { @@ -1381,6 +1589,18 @@ const file_account_proto_rawDesc = "" + "\t_language\"H\n" + "\x12ChangeDataResponse\x12\x18\n" + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x18\n" + + "\amessage\x18\x02 \x01(\tR\amessage\"E\n" + + "\x11AssignRoleRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x17\n" + + "\arole_id\x18\x02 \x01(\tR\x06roleId\"H\n" + + "\x12AssignRoleResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x18\n" + + "\amessage\x18\x02 \x01(\tR\amessage\"E\n" + + "\x11RevokeRoleRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x17\n" + + "\arole_id\x18\x02 \x01(\tR\x06roleId\"H\n" + + "\x12RevokeRoleResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x18\n" + "\amessage\x18\x02 \x01(\tR\amessage\"W\n" + "\x19AdminResetPasswordRequest\x12\x17\n" + "\auser_id\x18\x01 \x01(\tR\x06userId\x12!\n" + @@ -1420,7 +1640,7 @@ const file_account_proto_rawDesc = "" + "session_id\x18\x03 \x01(\tR\tsessionId\"G\n" + "\x11RemovePinResponse\x12\x18\n" + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x18\n" + - "\amessage\x18\x02 \x01(\tR\amessage2\xaa\x06\n" + + "\amessage\x18\x02 \x01(\tR\amessage2\xc4\a\n" + "\x0eAccountService\x12K\n" + "\n" + "GetAccount\x12\x1d.account.v1.GetAccountRequest\x1a\x1e.account.v1.GetAccountResponse\x12W\n" + @@ -1431,7 +1651,11 @@ const file_account_proto_rawDesc = "" + "\n" + "DeleteUser\x12\x1d.account.v1.DeleteUserRequest\x1a\x1e.account.v1.DeleteUserResponse\x12K\n" + "\n" + - "ChangeData\x12\x1d.account.v1.ChangeDataRequest\x1a\x1e.account.v1.ChangeDataResponse\x12?\n" + + "ChangeData\x12\x1d.account.v1.ChangeDataRequest\x1a\x1e.account.v1.ChangeDataResponse\x12K\n" + + "\n" + + "AssignRole\x12\x1d.account.v1.AssignRoleRequest\x1a\x1e.account.v1.AssignRoleResponse\x12K\n" + + "\n" + + "RevokeRole\x12\x1d.account.v1.RevokeRoleRequest\x1a\x1e.account.v1.RevokeRoleResponse\x12?\n" + "\x06SetPin\x12\x19.account.v1.SetPinRequest\x1a\x1a.account.v1.SetPinResponse\x12H\n" + "\tUnlockPin\x12\x1c.account.v1.UnlockPinRequest\x1a\x1d.account.v1.UnlockPinResponse\x12Q\n" + "\fGetPinStatus\x12\x1f.account.v1.GetPinStatusRequest\x1a .account.v1.GetPinStatusResponse\x12H\n" + @@ -1449,7 +1673,7 @@ func file_account_proto_rawDescGZIP() []byte { return file_account_proto_rawDescData } -var file_account_proto_msgTypes = make([]protoimpl.MessageInfo, 20) +var file_account_proto_msgTypes = make([]protoimpl.MessageInfo, 24) var file_account_proto_goTypes = []any{ (*GetAccountRequest)(nil), // 0: account.v1.GetAccountRequest (*GetAccountResponse)(nil), // 1: account.v1.GetAccountResponse @@ -1461,40 +1685,48 @@ var file_account_proto_goTypes = []any{ (*DeleteUserResponse)(nil), // 7: account.v1.DeleteUserResponse (*ChangeDataRequest)(nil), // 8: account.v1.ChangeDataRequest (*ChangeDataResponse)(nil), // 9: account.v1.ChangeDataResponse - (*AdminResetPasswordRequest)(nil), // 10: account.v1.AdminResetPasswordRequest - (*AdminResetPasswordResponse)(nil), // 11: account.v1.AdminResetPasswordResponse - (*SetPinRequest)(nil), // 12: account.v1.SetPinRequest - (*SetPinResponse)(nil), // 13: account.v1.SetPinResponse - (*UnlockPinRequest)(nil), // 14: account.v1.UnlockPinRequest - (*UnlockPinResponse)(nil), // 15: account.v1.UnlockPinResponse - (*GetPinStatusRequest)(nil), // 16: account.v1.GetPinStatusRequest - (*GetPinStatusResponse)(nil), // 17: account.v1.GetPinStatusResponse - (*RemovePinRequest)(nil), // 18: account.v1.RemovePinRequest - (*RemovePinResponse)(nil), // 19: account.v1.RemovePinResponse + (*AssignRoleRequest)(nil), // 10: account.v1.AssignRoleRequest + (*AssignRoleResponse)(nil), // 11: account.v1.AssignRoleResponse + (*RevokeRoleRequest)(nil), // 12: account.v1.RevokeRoleRequest + (*RevokeRoleResponse)(nil), // 13: account.v1.RevokeRoleResponse + (*AdminResetPasswordRequest)(nil), // 14: account.v1.AdminResetPasswordRequest + (*AdminResetPasswordResponse)(nil), // 15: account.v1.AdminResetPasswordResponse + (*SetPinRequest)(nil), // 16: account.v1.SetPinRequest + (*SetPinResponse)(nil), // 17: account.v1.SetPinResponse + (*UnlockPinRequest)(nil), // 18: account.v1.UnlockPinRequest + (*UnlockPinResponse)(nil), // 19: account.v1.UnlockPinResponse + (*GetPinStatusRequest)(nil), // 20: account.v1.GetPinStatusRequest + (*GetPinStatusResponse)(nil), // 21: account.v1.GetPinStatusResponse + (*RemovePinRequest)(nil), // 22: account.v1.RemovePinRequest + (*RemovePinResponse)(nil), // 23: account.v1.RemovePinResponse } var file_account_proto_depIdxs = []int32{ 0, // 0: account.v1.AccountService.GetAccount:input_type -> account.v1.GetAccountRequest 2, // 1: account.v1.AccountService.ChangePassword:input_type -> account.v1.ChangePasswordRequest - 10, // 2: account.v1.AccountService.AdminResetPassword:input_type -> account.v1.AdminResetPasswordRequest + 14, // 2: account.v1.AccountService.AdminResetPassword:input_type -> account.v1.AdminResetPasswordRequest 4, // 3: account.v1.AccountService.CreateUser:input_type -> account.v1.CreateUserRequest 6, // 4: account.v1.AccountService.DeleteUser:input_type -> account.v1.DeleteUserRequest 8, // 5: account.v1.AccountService.ChangeData:input_type -> account.v1.ChangeDataRequest - 12, // 6: account.v1.AccountService.SetPin:input_type -> account.v1.SetPinRequest - 14, // 7: account.v1.AccountService.UnlockPin:input_type -> account.v1.UnlockPinRequest - 16, // 8: account.v1.AccountService.GetPinStatus:input_type -> account.v1.GetPinStatusRequest - 18, // 9: account.v1.AccountService.RemovePin:input_type -> account.v1.RemovePinRequest - 1, // 10: account.v1.AccountService.GetAccount:output_type -> account.v1.GetAccountResponse - 3, // 11: account.v1.AccountService.ChangePassword:output_type -> account.v1.ChangePasswordResponse - 11, // 12: account.v1.AccountService.AdminResetPassword:output_type -> account.v1.AdminResetPasswordResponse - 5, // 13: account.v1.AccountService.CreateUser:output_type -> account.v1.CreateUserResponse - 7, // 14: account.v1.AccountService.DeleteUser:output_type -> account.v1.DeleteUserResponse - 9, // 15: account.v1.AccountService.ChangeData:output_type -> account.v1.ChangeDataResponse - 13, // 16: account.v1.AccountService.SetPin:output_type -> account.v1.SetPinResponse - 15, // 17: account.v1.AccountService.UnlockPin:output_type -> account.v1.UnlockPinResponse - 17, // 18: account.v1.AccountService.GetPinStatus:output_type -> account.v1.GetPinStatusResponse - 19, // 19: account.v1.AccountService.RemovePin:output_type -> account.v1.RemovePinResponse - 10, // [10:20] is the sub-list for method output_type - 0, // [0:10] is the sub-list for method input_type + 10, // 6: account.v1.AccountService.AssignRole:input_type -> account.v1.AssignRoleRequest + 12, // 7: account.v1.AccountService.RevokeRole:input_type -> account.v1.RevokeRoleRequest + 16, // 8: account.v1.AccountService.SetPin:input_type -> account.v1.SetPinRequest + 18, // 9: account.v1.AccountService.UnlockPin:input_type -> account.v1.UnlockPinRequest + 20, // 10: account.v1.AccountService.GetPinStatus:input_type -> account.v1.GetPinStatusRequest + 22, // 11: account.v1.AccountService.RemovePin:input_type -> account.v1.RemovePinRequest + 1, // 12: account.v1.AccountService.GetAccount:output_type -> account.v1.GetAccountResponse + 3, // 13: account.v1.AccountService.ChangePassword:output_type -> account.v1.ChangePasswordResponse + 15, // 14: account.v1.AccountService.AdminResetPassword:output_type -> account.v1.AdminResetPasswordResponse + 5, // 15: account.v1.AccountService.CreateUser:output_type -> account.v1.CreateUserResponse + 7, // 16: account.v1.AccountService.DeleteUser:output_type -> account.v1.DeleteUserResponse + 9, // 17: account.v1.AccountService.ChangeData:output_type -> account.v1.ChangeDataResponse + 11, // 18: account.v1.AccountService.AssignRole:output_type -> account.v1.AssignRoleResponse + 13, // 19: account.v1.AccountService.RevokeRole:output_type -> account.v1.RevokeRoleResponse + 17, // 20: account.v1.AccountService.SetPin:output_type -> account.v1.SetPinResponse + 19, // 21: account.v1.AccountService.UnlockPin:output_type -> account.v1.UnlockPinResponse + 21, // 22: account.v1.AccountService.GetPinStatus:output_type -> account.v1.GetPinStatusResponse + 23, // 23: account.v1.AccountService.RemovePin:output_type -> account.v1.RemovePinResponse + 12, // [12:24] is the sub-list for method output_type + 0, // [0:12] 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 @@ -1514,7 +1746,7 @@ func file_account_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_account_proto_rawDesc), len(file_account_proto_rawDesc)), NumEnums: 0, - NumMessages: 20, + NumMessages: 24, NumExtensions: 0, NumServices: 1, }, diff --git a/gen/go/account_grpc.pb.go b/gen/go/account_grpc.pb.go index cce1505..2b18333 100644 --- a/gen/go/account_grpc.pb.go +++ b/gen/go/account_grpc.pb.go @@ -25,6 +25,8 @@ const ( AccountService_CreateUser_FullMethodName = "/account.v1.AccountService/CreateUser" AccountService_DeleteUser_FullMethodName = "/account.v1.AccountService/DeleteUser" AccountService_ChangeData_FullMethodName = "/account.v1.AccountService/ChangeData" + AccountService_AssignRole_FullMethodName = "/account.v1.AccountService/AssignRole" + AccountService_RevokeRole_FullMethodName = "/account.v1.AccountService/RevokeRole" AccountService_SetPin_FullMethodName = "/account.v1.AccountService/SetPin" AccountService_UnlockPin_FullMethodName = "/account.v1.AccountService/UnlockPin" AccountService_GetPinStatus_FullMethodName = "/account.v1.AccountService/GetPinStatus" @@ -41,6 +43,8 @@ type AccountServiceClient interface { CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*DeleteUserResponse, error) ChangeData(ctx context.Context, in *ChangeDataRequest, opts ...grpc.CallOption) (*ChangeDataResponse, error) + AssignRole(ctx context.Context, in *AssignRoleRequest, opts ...grpc.CallOption) (*AssignRoleResponse, error) + RevokeRole(ctx context.Context, in *RevokeRoleRequest, opts ...grpc.CallOption) (*RevokeRoleResponse, error) SetPin(ctx context.Context, in *SetPinRequest, opts ...grpc.CallOption) (*SetPinResponse, error) UnlockPin(ctx context.Context, in *UnlockPinRequest, opts ...grpc.CallOption) (*UnlockPinResponse, error) GetPinStatus(ctx context.Context, in *GetPinStatusRequest, opts ...grpc.CallOption) (*GetPinStatusResponse, error) @@ -115,6 +119,26 @@ func (c *accountServiceClient) ChangeData(ctx context.Context, in *ChangeDataReq return out, nil } +func (c *accountServiceClient) AssignRole(ctx context.Context, in *AssignRoleRequest, opts ...grpc.CallOption) (*AssignRoleResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AssignRoleResponse) + err := c.cc.Invoke(ctx, AccountService_AssignRole_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *accountServiceClient) RevokeRole(ctx context.Context, in *RevokeRoleRequest, opts ...grpc.CallOption) (*RevokeRoleResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RevokeRoleResponse) + err := c.cc.Invoke(ctx, AccountService_RevokeRole_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *accountServiceClient) SetPin(ctx context.Context, in *SetPinRequest, opts ...grpc.CallOption) (*SetPinResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(SetPinResponse) @@ -165,6 +189,8 @@ type AccountServiceServer interface { CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error) DeleteUser(context.Context, *DeleteUserRequest) (*DeleteUserResponse, error) ChangeData(context.Context, *ChangeDataRequest) (*ChangeDataResponse, error) + AssignRole(context.Context, *AssignRoleRequest) (*AssignRoleResponse, error) + RevokeRole(context.Context, *RevokeRoleRequest) (*RevokeRoleResponse, error) SetPin(context.Context, *SetPinRequest) (*SetPinResponse, error) UnlockPin(context.Context, *UnlockPinRequest) (*UnlockPinResponse, error) GetPinStatus(context.Context, *GetPinStatusRequest) (*GetPinStatusResponse, error) @@ -197,6 +223,12 @@ func (UnimplementedAccountServiceServer) DeleteUser(context.Context, *DeleteUser func (UnimplementedAccountServiceServer) ChangeData(context.Context, *ChangeDataRequest) (*ChangeDataResponse, error) { return nil, status.Error(codes.Unimplemented, "method ChangeData not implemented") } +func (UnimplementedAccountServiceServer) AssignRole(context.Context, *AssignRoleRequest) (*AssignRoleResponse, error) { + return nil, status.Error(codes.Unimplemented, "method AssignRole not implemented") +} +func (UnimplementedAccountServiceServer) RevokeRole(context.Context, *RevokeRoleRequest) (*RevokeRoleResponse, error) { + return nil, status.Error(codes.Unimplemented, "method RevokeRole not implemented") +} func (UnimplementedAccountServiceServer) SetPin(context.Context, *SetPinRequest) (*SetPinResponse, error) { return nil, status.Error(codes.Unimplemented, "method SetPin not implemented") } @@ -338,6 +370,42 @@ func _AccountService_ChangeData_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } +func _AccountService_AssignRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AssignRoleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AccountServiceServer).AssignRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AccountService_AssignRole_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AccountServiceServer).AssignRole(ctx, req.(*AssignRoleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AccountService_RevokeRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RevokeRoleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AccountServiceServer).RevokeRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AccountService_RevokeRole_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AccountServiceServer).RevokeRole(ctx, req.(*RevokeRoleRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _AccountService_SetPin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SetPinRequest) if err := dec(in); err != nil { @@ -441,6 +509,14 @@ var AccountService_ServiceDesc = grpc.ServiceDesc{ MethodName: "ChangeData", Handler: _AccountService_ChangeData_Handler, }, + { + MethodName: "AssignRole", + Handler: _AccountService_AssignRole_Handler, + }, + { + MethodName: "RevokeRole", + Handler: _AccountService_RevokeRole_Handler, + }, { MethodName: "SetPin", Handler: _AccountService_SetPin_Handler, diff --git a/gen/go/rbac.pb.go b/gen/go/rbac.pb.go index f3a7ccf..1ed4958 100644 --- a/gen/go/rbac.pb.go +++ b/gen/go/rbac.pb.go @@ -289,6 +289,454 @@ func (x *GetAllRolesResponse) GetRoles() []*Roles { return nil } +type CreateRoleRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Level int32 `protobuf:"varint,2,opt,name=level,proto3" json:"level,omitempty"` + PermissionCodes []string `protobuf:"bytes,3,rep,name=permission_codes,json=permissionCodes,proto3" json:"permission_codes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateRoleRequest) Reset() { + *x = CreateRoleRequest{} + mi := &file_rbac_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateRoleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateRoleRequest) ProtoMessage() {} + +func (x *CreateRoleRequest) ProtoReflect() protoreflect.Message { + mi := &file_rbac_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 CreateRoleRequest.ProtoReflect.Descriptor instead. +func (*CreateRoleRequest) Descriptor() ([]byte, []int) { + return file_rbac_proto_rawDescGZIP(), []int{5} +} + +func (x *CreateRoleRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateRoleRequest) GetLevel() int32 { + if x != nil { + return x.Level + } + return 0 +} + +func (x *CreateRoleRequest) GetPermissionCodes() []string { + if x != nil { + return x.PermissionCodes + } + return nil +} + +type UpdateRoleRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name *string `protobuf:"bytes,2,opt,name=name,proto3,oneof" json:"name,omitempty"` + Level *int32 `protobuf:"varint,3,opt,name=level,proto3,oneof" json:"level,omitempty"` + PermissionCodes []string `protobuf:"bytes,4,rep,name=permission_codes,json=permissionCodes,proto3" json:"permission_codes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateRoleRequest) Reset() { + *x = UpdateRoleRequest{} + mi := &file_rbac_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateRoleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateRoleRequest) ProtoMessage() {} + +func (x *UpdateRoleRequest) ProtoReflect() protoreflect.Message { + mi := &file_rbac_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 UpdateRoleRequest.ProtoReflect.Descriptor instead. +func (*UpdateRoleRequest) Descriptor() ([]byte, []int) { + return file_rbac_proto_rawDescGZIP(), []int{6} +} + +func (x *UpdateRoleRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UpdateRoleRequest) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *UpdateRoleRequest) GetLevel() int32 { + if x != nil && x.Level != nil { + return *x.Level + } + return 0 +} + +func (x *UpdateRoleRequest) GetPermissionCodes() []string { + if x != nil { + return x.PermissionCodes + } + return nil +} + +type ModifyRoleResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModifyRoleResponse) Reset() { + *x = ModifyRoleResponse{} + mi := &file_rbac_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModifyRoleResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModifyRoleResponse) ProtoMessage() {} + +func (x *ModifyRoleResponse) ProtoReflect() protoreflect.Message { + mi := &file_rbac_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 ModifyRoleResponse.ProtoReflect.Descriptor instead. +func (*ModifyRoleResponse) Descriptor() ([]byte, []int) { + return file_rbac_proto_rawDescGZIP(), []int{7} +} + +func (x *ModifyRoleResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ModifyRoleResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type DeleteRoleRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteRoleRequest) Reset() { + *x = DeleteRoleRequest{} + mi := &file_rbac_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteRoleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRoleRequest) ProtoMessage() {} + +func (x *DeleteRoleRequest) ProtoReflect() protoreflect.Message { + mi := &file_rbac_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 DeleteRoleRequest.ProtoReflect.Descriptor instead. +func (*DeleteRoleRequest) Descriptor() ([]byte, []int) { + return file_rbac_proto_rawDescGZIP(), []int{8} +} + +func (x *DeleteRoleRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type DeleteRoleResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + FallbackRoleName *string `protobuf:"bytes,3,opt,name=fallback_role_name,json=fallbackRoleName,proto3,oneof" json:"fallback_role_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteRoleResponse) Reset() { + *x = DeleteRoleResponse{} + mi := &file_rbac_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteRoleResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRoleResponse) ProtoMessage() {} + +func (x *DeleteRoleResponse) ProtoReflect() protoreflect.Message { + mi := &file_rbac_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 DeleteRoleResponse.ProtoReflect.Descriptor instead. +func (*DeleteRoleResponse) Descriptor() ([]byte, []int) { + return file_rbac_proto_rawDescGZIP(), []int{9} +} + +func (x *DeleteRoleResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *DeleteRoleResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *DeleteRoleResponse) GetFallbackRoleName() string { + if x != nil && x.FallbackRoleName != nil { + return *x.FallbackRoleName + } + return "" +} + +type CreatePermissionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Module string `protobuf:"bytes,3,opt,name=module,proto3" json:"module,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreatePermissionRequest) Reset() { + *x = CreatePermissionRequest{} + mi := &file_rbac_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreatePermissionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePermissionRequest) ProtoMessage() {} + +func (x *CreatePermissionRequest) ProtoReflect() protoreflect.Message { + mi := &file_rbac_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 CreatePermissionRequest.ProtoReflect.Descriptor instead. +func (*CreatePermissionRequest) Descriptor() ([]byte, []int) { + return file_rbac_proto_rawDescGZIP(), []int{10} +} + +func (x *CreatePermissionRequest) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +func (x *CreatePermissionRequest) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *CreatePermissionRequest) GetModule() string { + if x != nil { + return x.Module + } + return "" +} + +type UpdatePermissionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + RoleIds []string `protobuf:"bytes,2,rep,name=role_ids,json=roleIds,proto3" json:"role_ids,omitempty"` // Привязка к конкретным ролям + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdatePermissionRequest) Reset() { + *x = UpdatePermissionRequest{} + mi := &file_rbac_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdatePermissionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdatePermissionRequest) ProtoMessage() {} + +func (x *UpdatePermissionRequest) ProtoReflect() protoreflect.Message { + mi := &file_rbac_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 UpdatePermissionRequest.ProtoReflect.Descriptor instead. +func (*UpdatePermissionRequest) Descriptor() ([]byte, []int) { + return file_rbac_proto_rawDescGZIP(), []int{11} +} + +func (x *UpdatePermissionRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UpdatePermissionRequest) GetRoleIds() []string { + if x != nil { + return x.RoleIds + } + return nil +} + +type ModifyPermissionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ModifyPermissionResponse) Reset() { + *x = ModifyPermissionResponse{} + mi := &file_rbac_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ModifyPermissionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModifyPermissionResponse) ProtoMessage() {} + +func (x *ModifyPermissionResponse) ProtoReflect() protoreflect.Message { + mi := &file_rbac_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 ModifyPermissionResponse.ProtoReflect.Descriptor instead. +func (*ModifyPermissionResponse) Descriptor() ([]byte, []int) { + return file_rbac_proto_rawDescGZIP(), []int{12} +} + +func (x *ModifyPermissionResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ModifyPermissionResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + type Roles struct { state protoimpl.MessageState `protogen:"open.v1"` Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` @@ -303,7 +751,7 @@ type Roles struct { func (x *Roles) Reset() { *x = Roles{} - mi := &file_rbac_proto_msgTypes[5] + mi := &file_rbac_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -315,7 +763,7 @@ func (x *Roles) String() string { func (*Roles) ProtoMessage() {} func (x *Roles) ProtoReflect() protoreflect.Message { - mi := &file_rbac_proto_msgTypes[5] + mi := &file_rbac_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -328,7 +776,7 @@ func (x *Roles) ProtoReflect() protoreflect.Message { // Deprecated: Use Roles.ProtoReflect.Descriptor instead. func (*Roles) Descriptor() ([]byte, []int) { - return file_rbac_proto_rawDescGZIP(), []int{5} + return file_rbac_proto_rawDescGZIP(), []int{13} } func (x *Roles) GetId() string { @@ -397,15 +845,54 @@ const file_rbac_proto_rawDesc = "" + "\n" + "session_id\x18\x02 \x01(\tR\tsessionId\";\n" + "\x13GetAllRolesResponse\x12$\n" + - "\x05roles\x18\x01 \x03(\v2\x0e.rbac.v1.RolesR\x05roles\"\xa2\x01\n" + + "\x05roles\x18\x01 \x03(\v2\x0e.rbac.v1.RolesR\x05roles\"h\n" + + "\x11CreateRoleRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" + + "\x05level\x18\x02 \x01(\x05R\x05level\x12)\n" + + "\x10permission_codes\x18\x03 \x03(\tR\x0fpermissionCodes\"\x95\x01\n" + + "\x11UpdateRoleRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x17\n" + + "\x04name\x18\x02 \x01(\tH\x00R\x04name\x88\x01\x01\x12\x19\n" + + "\x05level\x18\x03 \x01(\x05H\x01R\x05level\x88\x01\x01\x12)\n" + + "\x10permission_codes\x18\x04 \x03(\tR\x0fpermissionCodesB\a\n" + + "\x05_nameB\b\n" + + "\x06_level\"H\n" + + "\x12ModifyRoleResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x18\n" + + "\amessage\x18\x02 \x01(\tR\amessage\"#\n" + + "\x11DeleteRoleRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"\x92\x01\n" + + "\x12DeleteRoleResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x18\n" + + "\amessage\x18\x02 \x01(\tR\amessage\x121\n" + + "\x12fallback_role_name\x18\x03 \x01(\tH\x00R\x10fallbackRoleName\x88\x01\x01B\x15\n" + + "\x13_fallback_role_name\"g\n" + + "\x17CreatePermissionRequest\x12\x12\n" + + "\x04code\x18\x01 \x01(\tR\x04code\x12 \n" + + "\vdescription\x18\x02 \x01(\tR\vdescription\x12\x16\n" + + "\x06module\x18\x03 \x01(\tR\x06module\"D\n" + + "\x17UpdatePermissionRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x19\n" + + "\brole_ids\x18\x02 \x03(\tR\aroleIds\"N\n" + + "\x18ModifyPermissionResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x18\n" + + "\amessage\x18\x02 \x01(\tR\amessage\"\xa2\x01\n" + "\x05Roles\x12\x0e\n" + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + "\x04name\x18\x02 \x01(\tR\x04name\x12\x14\n" + "\x05level\x18\x03 \x01(\x05R\x05level\x12 \n" + "\vpermissions\x18\x04 \x03(\tR\vpermissions\x12!\n" + "\fldap_mapping\x18\x05 \x03(\tR\vldapMapping\x12\x1a\n" + - "\baccounts\x18\x06 \x03(\tR\baccounts2\xb3\x01\n" + - "\vRbacService\x12Z\n" + + "\baccounts\x18\x06 \x03(\tR\baccounts2\xba\x04\n" + + "\vRbacService\x12E\n" + + "\n" + + "CreateRole\x12\x1a.rbac.v1.CreateRoleRequest\x1a\x1b.rbac.v1.ModifyRoleResponse\x12E\n" + + "\n" + + "UpdateRole\x12\x1a.rbac.v1.UpdateRoleRequest\x1a\x1b.rbac.v1.ModifyRoleResponse\x12E\n" + + "\n" + + "DeleteRole\x12\x1a.rbac.v1.DeleteRoleRequest\x1a\x1b.rbac.v1.DeleteRoleResponse\x12W\n" + + "\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.GetAllRolesResponseB*Z(git.lendry.ru/lendry-erp/proto.git/go;pbb\x06proto3" @@ -421,27 +908,45 @@ func file_rbac_proto_rawDescGZIP() []byte { return file_rbac_proto_rawDescData } -var file_rbac_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_rbac_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_rbac_proto_goTypes = []any{ (*GetAllPermissionsRequest)(nil), // 0: rbac.v1.GetAllPermissionsRequest (*GetAllPermissionsResponse)(nil), // 1: rbac.v1.GetAllPermissionsResponse (*Permission)(nil), // 2: rbac.v1.Permission (*GetAllRolesRequest)(nil), // 3: rbac.v1.GetAllRolesRequest (*GetAllRolesResponse)(nil), // 4: rbac.v1.GetAllRolesResponse - (*Roles)(nil), // 5: rbac.v1.Roles + (*CreateRoleRequest)(nil), // 5: rbac.v1.CreateRoleRequest + (*UpdateRoleRequest)(nil), // 6: rbac.v1.UpdateRoleRequest + (*ModifyRoleResponse)(nil), // 7: rbac.v1.ModifyRoleResponse + (*DeleteRoleRequest)(nil), // 8: rbac.v1.DeleteRoleRequest + (*DeleteRoleResponse)(nil), // 9: rbac.v1.DeleteRoleResponse + (*CreatePermissionRequest)(nil), // 10: rbac.v1.CreatePermissionRequest + (*UpdatePermissionRequest)(nil), // 11: rbac.v1.UpdatePermissionRequest + (*ModifyPermissionResponse)(nil), // 12: rbac.v1.ModifyPermissionResponse + (*Roles)(nil), // 13: rbac.v1.Roles } var file_rbac_proto_depIdxs = []int32{ - 2, // 0: rbac.v1.GetAllPermissionsResponse.permissions:type_name -> rbac.v1.Permission - 5, // 1: rbac.v1.GetAllRolesResponse.roles:type_name -> rbac.v1.Roles - 0, // 2: rbac.v1.RbacService.GetAllPermissions:input_type -> rbac.v1.GetAllPermissionsRequest - 3, // 3: rbac.v1.RbacService.GetAllRoles:input_type -> rbac.v1.GetAllRolesRequest - 1, // 4: rbac.v1.RbacService.GetAllPermissions:output_type -> rbac.v1.GetAllPermissionsResponse - 4, // 5: rbac.v1.RbacService.GetAllRoles:output_type -> rbac.v1.GetAllRolesResponse - 4, // [4:6] is the sub-list for method output_type - 2, // [2:4] 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 + 2, // 0: rbac.v1.GetAllPermissionsResponse.permissions:type_name -> rbac.v1.Permission + 13, // 1: rbac.v1.GetAllRolesResponse.roles:type_name -> rbac.v1.Roles + 5, // 2: rbac.v1.RbacService.CreateRole:input_type -> rbac.v1.CreateRoleRequest + 6, // 3: rbac.v1.RbacService.UpdateRole:input_type -> rbac.v1.UpdateRoleRequest + 8, // 4: rbac.v1.RbacService.DeleteRole:input_type -> rbac.v1.DeleteRoleRequest + 10, // 5: rbac.v1.RbacService.CreatePermission:input_type -> rbac.v1.CreatePermissionRequest + 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 + 7, // 9: rbac.v1.RbacService.CreateRole:output_type -> rbac.v1.ModifyRoleResponse + 7, // 10: rbac.v1.RbacService.UpdateRole:output_type -> rbac.v1.ModifyRoleResponse + 9, // 11: rbac.v1.RbacService.DeleteRole:output_type -> rbac.v1.DeleteRoleResponse + 12, // 12: rbac.v1.RbacService.CreatePermission:output_type -> rbac.v1.ModifyPermissionResponse + 12, // 13: rbac.v1.RbacService.UpdatePermission:output_type -> rbac.v1.ModifyPermissionResponse + 1, // 14: rbac.v1.RbacService.GetAllPermissions:output_type -> rbac.v1.GetAllPermissionsResponse + 4, // 15: rbac.v1.RbacService.GetAllRoles:output_type -> rbac.v1.GetAllRolesResponse + 9, // [9:16] is the sub-list for method output_type + 2, // [2:9] 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 } func init() { file_rbac_proto_init() } @@ -449,13 +954,15 @@ func file_rbac_proto_init() { if File_rbac_proto != nil { return } + file_rbac_proto_msgTypes[6].OneofWrappers = []any{} + file_rbac_proto_msgTypes[9].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_rbac_proto_rawDesc), len(file_rbac_proto_rawDesc)), NumEnums: 0, - NumMessages: 6, + NumMessages: 14, NumExtensions: 0, NumServices: 1, }, diff --git a/gen/go/rbac_grpc.pb.go b/gen/go/rbac_grpc.pb.go index ebddf2f..94093ff 100644 --- a/gen/go/rbac_grpc.pb.go +++ b/gen/go/rbac_grpc.pb.go @@ -19,6 +19,11 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( + RbacService_CreateRole_FullMethodName = "/rbac.v1.RbacService/CreateRole" + RbacService_UpdateRole_FullMethodName = "/rbac.v1.RbacService/UpdateRole" + RbacService_DeleteRole_FullMethodName = "/rbac.v1.RbacService/DeleteRole" + RbacService_CreatePermission_FullMethodName = "/rbac.v1.RbacService/CreatePermission" + RbacService_UpdatePermission_FullMethodName = "/rbac.v1.RbacService/UpdatePermission" RbacService_GetAllPermissions_FullMethodName = "/rbac.v1.RbacService/GetAllPermissions" RbacService_GetAllRoles_FullMethodName = "/rbac.v1.RbacService/GetAllRoles" ) @@ -27,6 +32,11 @@ const ( // // 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 RbacServiceClient interface { + CreateRole(ctx context.Context, in *CreateRoleRequest, opts ...grpc.CallOption) (*ModifyRoleResponse, error) + UpdateRole(ctx context.Context, in *UpdateRoleRequest, opts ...grpc.CallOption) (*ModifyRoleResponse, error) + DeleteRole(ctx context.Context, in *DeleteRoleRequest, opts ...grpc.CallOption) (*DeleteRoleResponse, error) + CreatePermission(ctx context.Context, in *CreatePermissionRequest, opts ...grpc.CallOption) (*ModifyPermissionResponse, error) + 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) } @@ -39,6 +49,56 @@ func NewRbacServiceClient(cc grpc.ClientConnInterface) RbacServiceClient { return &rbacServiceClient{cc} } +func (c *rbacServiceClient) CreateRole(ctx context.Context, in *CreateRoleRequest, opts ...grpc.CallOption) (*ModifyRoleResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ModifyRoleResponse) + err := c.cc.Invoke(ctx, RbacService_CreateRole_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *rbacServiceClient) UpdateRole(ctx context.Context, in *UpdateRoleRequest, opts ...grpc.CallOption) (*ModifyRoleResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ModifyRoleResponse) + err := c.cc.Invoke(ctx, RbacService_UpdateRole_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *rbacServiceClient) DeleteRole(ctx context.Context, in *DeleteRoleRequest, opts ...grpc.CallOption) (*DeleteRoleResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteRoleResponse) + err := c.cc.Invoke(ctx, RbacService_DeleteRole_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *rbacServiceClient) CreatePermission(ctx context.Context, in *CreatePermissionRequest, opts ...grpc.CallOption) (*ModifyPermissionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ModifyPermissionResponse) + err := c.cc.Invoke(ctx, RbacService_CreatePermission_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *rbacServiceClient) UpdatePermission(ctx context.Context, in *UpdatePermissionRequest, opts ...grpc.CallOption) (*ModifyPermissionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ModifyPermissionResponse) + err := c.cc.Invoke(ctx, RbacService_UpdatePermission_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *rbacServiceClient) GetAllPermissions(ctx context.Context, in *GetAllPermissionsRequest, opts ...grpc.CallOption) (*GetAllPermissionsResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(GetAllPermissionsResponse) @@ -63,6 +123,11 @@ func (c *rbacServiceClient) GetAllRoles(ctx context.Context, in *GetAllRolesRequ // All implementations must embed UnimplementedRbacServiceServer // for forward compatibility. type RbacServiceServer interface { + CreateRole(context.Context, *CreateRoleRequest) (*ModifyRoleResponse, error) + UpdateRole(context.Context, *UpdateRoleRequest) (*ModifyRoleResponse, error) + DeleteRole(context.Context, *DeleteRoleRequest) (*DeleteRoleResponse, error) + CreatePermission(context.Context, *CreatePermissionRequest) (*ModifyPermissionResponse, error) + UpdatePermission(context.Context, *UpdatePermissionRequest) (*ModifyPermissionResponse, error) GetAllPermissions(context.Context, *GetAllPermissionsRequest) (*GetAllPermissionsResponse, error) GetAllRoles(context.Context, *GetAllRolesRequest) (*GetAllRolesResponse, error) mustEmbedUnimplementedRbacServiceServer() @@ -75,6 +140,21 @@ type RbacServiceServer interface { // pointer dereference when methods are called. type UnimplementedRbacServiceServer struct{} +func (UnimplementedRbacServiceServer) CreateRole(context.Context, *CreateRoleRequest) (*ModifyRoleResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CreateRole not implemented") +} +func (UnimplementedRbacServiceServer) UpdateRole(context.Context, *UpdateRoleRequest) (*ModifyRoleResponse, error) { + return nil, status.Error(codes.Unimplemented, "method UpdateRole not implemented") +} +func (UnimplementedRbacServiceServer) DeleteRole(context.Context, *DeleteRoleRequest) (*DeleteRoleResponse, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteRole not implemented") +} +func (UnimplementedRbacServiceServer) CreatePermission(context.Context, *CreatePermissionRequest) (*ModifyPermissionResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CreatePermission not implemented") +} +func (UnimplementedRbacServiceServer) UpdatePermission(context.Context, *UpdatePermissionRequest) (*ModifyPermissionResponse, error) { + return nil, status.Error(codes.Unimplemented, "method UpdatePermission not implemented") +} func (UnimplementedRbacServiceServer) GetAllPermissions(context.Context, *GetAllPermissionsRequest) (*GetAllPermissionsResponse, error) { return nil, status.Error(codes.Unimplemented, "method GetAllPermissions not implemented") } @@ -102,6 +182,96 @@ func RegisterRbacServiceServer(s grpc.ServiceRegistrar, srv RbacServiceServer) { s.RegisterService(&RbacService_ServiceDesc, srv) } +func _RbacService_CreateRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateRoleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RbacServiceServer).CreateRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RbacService_CreateRole_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RbacServiceServer).CreateRole(ctx, req.(*CreateRoleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RbacService_UpdateRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateRoleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RbacServiceServer).UpdateRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RbacService_UpdateRole_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RbacServiceServer).UpdateRole(ctx, req.(*UpdateRoleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RbacService_DeleteRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRoleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RbacServiceServer).DeleteRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RbacService_DeleteRole_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RbacServiceServer).DeleteRole(ctx, req.(*DeleteRoleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RbacService_CreatePermission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreatePermissionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RbacServiceServer).CreatePermission(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RbacService_CreatePermission_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RbacServiceServer).CreatePermission(ctx, req.(*CreatePermissionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RbacService_UpdatePermission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdatePermissionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RbacServiceServer).UpdatePermission(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RbacService_UpdatePermission_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RbacServiceServer).UpdatePermission(ctx, req.(*UpdatePermissionRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _RbacService_GetAllPermissions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetAllPermissionsRequest) if err := dec(in); err != nil { @@ -145,6 +315,26 @@ var RbacService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "rbac.v1.RbacService", HandlerType: (*RbacServiceServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "CreateRole", + Handler: _RbacService_CreateRole_Handler, + }, + { + MethodName: "UpdateRole", + Handler: _RbacService_UpdateRole_Handler, + }, + { + MethodName: "DeleteRole", + Handler: _RbacService_DeleteRole_Handler, + }, + { + MethodName: "CreatePermission", + Handler: _RbacService_CreatePermission_Handler, + }, + { + MethodName: "UpdatePermission", + Handler: _RbacService_UpdatePermission_Handler, + }, { MethodName: "GetAllPermissions", Handler: _RbacService_GetAllPermissions_Handler, diff --git a/gen/rbac.ts b/gen/rbac.ts index 1afae2a..ae7103c 100644 --- a/gen/rbac.ts +++ b/gen/rbac.ts @@ -37,6 +37,51 @@ export interface GetAllRolesResponse { roles: Roles[]; } +export interface CreateRoleRequest { + name: string; + level: number; + permissionCodes: string[]; +} + +export interface UpdateRoleRequest { + id: string; + name?: string | undefined; + level?: number | undefined; + permissionCodes: string[]; +} + +export interface ModifyRoleResponse { + success: boolean; + message: string; +} + +export interface DeleteRoleRequest { + id: string; +} + +export interface DeleteRoleResponse { + success: boolean; + message: string; + fallbackRoleName?: string | undefined; +} + +export interface CreatePermissionRequest { + code: string; + description: string; + module: string; +} + +export interface UpdatePermissionRequest { + id: string; + /** Привязка к конкретным ролям */ + roleIds: string[]; +} + +export interface ModifyPermissionResponse { + success: boolean; + message: string; +} + export interface Roles { id: string; name: string; @@ -49,12 +94,47 @@ export interface Roles { export const RBAC_V1_PACKAGE_NAME = "rbac.v1"; export interface RbacServiceClient { + createRole(request: CreateRoleRequest, metadata?: Metadata): Observable; + + updateRole(request: UpdateRoleRequest, metadata?: Metadata): Observable; + + deleteRole(request: DeleteRoleRequest, metadata?: Metadata): Observable; + + createPermission(request: CreatePermissionRequest, metadata?: Metadata): Observable; + + updatePermission(request: UpdatePermissionRequest, metadata?: Metadata): Observable; + getAllPermissions(request: GetAllPermissionsRequest, metadata?: Metadata): Observable; getAllRoles(request: GetAllRolesRequest, metadata?: Metadata): Observable; } export interface RbacServiceController { + createRole( + request: CreateRoleRequest, + metadata?: Metadata, + ): Promise | Observable | ModifyRoleResponse; + + updateRole( + request: UpdateRoleRequest, + metadata?: Metadata, + ): Promise | Observable | ModifyRoleResponse; + + deleteRole( + request: DeleteRoleRequest, + metadata?: Metadata, + ): Promise | Observable | DeleteRoleResponse; + + createPermission( + request: CreatePermissionRequest, + metadata?: Metadata, + ): Promise | Observable | ModifyPermissionResponse; + + updatePermission( + request: UpdatePermissionRequest, + metadata?: Metadata, + ): Promise | Observable | ModifyPermissionResponse; + getAllPermissions( request: GetAllPermissionsRequest, metadata?: Metadata, @@ -68,7 +148,15 @@ export interface RbacServiceController { export function RbacServiceControllerMethods() { return function (constructor: Function) { - const grpcMethods: string[] = ["getAllPermissions", "getAllRoles"]; + const grpcMethods: string[] = [ + "createRole", + "updateRole", + "deleteRole", + "createPermission", + "updatePermission", + "getAllPermissions", + "getAllRoles", + ]; for (const method of grpcMethods) { const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); GrpcMethod("RbacService", method)(constructor.prototype[method], method, descriptor);