mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-06 23:00:24 +08:00
[系统用户]实现系统用户的增删改
This commit is contained in:
@@ -34,6 +34,9 @@ type Admin struct {
|
||||
Fullname string `protobuf:"bytes,2,opt,name=fullname,proto3" json:"fullname,omitempty"`
|
||||
Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"`
|
||||
IsOn bool `protobuf:"varint,4,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
||||
IsSuper bool `protobuf:"varint,5,opt,name=isSuper,proto3" json:"isSuper,omitempty"`
|
||||
CreatedAt int64 `protobuf:"varint,6,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
|
||||
Modules []*AdminModule `protobuf:"bytes,7,rep,name=Modules,proto3" json:"Modules,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Admin) Reset() {
|
||||
@@ -96,18 +99,47 @@ func (x *Admin) GetIsOn() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *Admin) GetIsSuper() bool {
|
||||
if x != nil {
|
||||
return x.IsSuper
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *Admin) GetCreatedAt() int64 {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Admin) GetModules() []*AdminModule {
|
||||
if x != nil {
|
||||
return x.Modules
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_model_admin_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_model_admin_proto_rawDesc = []byte{
|
||||
0x0a, 0x11, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x63, 0x0a, 0x05, 0x41, 0x64, 0x6d, 0x69, 0x6e,
|
||||
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64,
|
||||
0x12, 0x1a, 0x0a, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08,
|
||||
0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
|
||||
0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x42, 0x06, 0x5a, 0x04,
|
||||
0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x18, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x61,
|
||||
0x64, 0x6d, 0x69, 0x6e, 0x5f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x22, 0xc6, 0x01, 0x0a, 0x05, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x66,
|
||||
0x75, 0x6c, 0x6c, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66,
|
||||
0x75, 0x6c, 0x6c, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e,
|
||||
0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e,
|
||||
0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x53, 0x75, 0x70,
|
||||
0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x53, 0x75, 0x70, 0x65,
|
||||
0x72, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x06,
|
||||
0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12,
|
||||
0x29, 0x0a, 0x07, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b,
|
||||
0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
|
||||
0x65, 0x52, 0x07, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f,
|
||||
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -125,13 +157,15 @@ func file_model_admin_proto_rawDescGZIP() []byte {
|
||||
var file_model_admin_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_model_admin_proto_goTypes = []interface{}{
|
||||
(*Admin)(nil), // 0: pb.Admin
|
||||
(*AdminModule)(nil), // 1: pb.AdminModule
|
||||
}
|
||||
var file_model_admin_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] 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
|
||||
1, // 0: pb.Admin.Modules:type_name -> pb.AdminModule
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
1, // [1:1] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_model_admin_proto_init() }
|
||||
@@ -139,6 +173,7 @@ func file_model_admin_proto_init() {
|
||||
if File_model_admin_proto != nil {
|
||||
return
|
||||
}
|
||||
file_model_admin_module_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_model_admin_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Admin); i {
|
||||
|
||||
172
pkg/rpc/pb/model_admin_list.pb.go
Normal file
172
pkg/rpc/pb/model_admin_list.pb.go
Normal file
@@ -0,0 +1,172 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: model_admin_list.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type AdminModuleList struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
AdminId int64 `protobuf:"varint,1,opt,name=adminId,proto3" json:"adminId,omitempty"`
|
||||
IsSuper bool `protobuf:"varint,2,opt,name=isSuper,proto3" json:"isSuper,omitempty"`
|
||||
Modules []*AdminModule `protobuf:"bytes,3,rep,name=Modules,proto3" json:"Modules,omitempty"`
|
||||
}
|
||||
|
||||
func (x *AdminModuleList) Reset() {
|
||||
*x = AdminModuleList{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_model_admin_list_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AdminModuleList) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AdminModuleList) ProtoMessage() {}
|
||||
|
||||
func (x *AdminModuleList) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_model_admin_list_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AdminModuleList.ProtoReflect.Descriptor instead.
|
||||
func (*AdminModuleList) Descriptor() ([]byte, []int) {
|
||||
return file_model_admin_list_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *AdminModuleList) GetAdminId() int64 {
|
||||
if x != nil {
|
||||
return x.AdminId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *AdminModuleList) GetIsSuper() bool {
|
||||
if x != nil {
|
||||
return x.IsSuper
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *AdminModuleList) GetModules() []*AdminModule {
|
||||
if x != nil {
|
||||
return x.Modules
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_model_admin_list_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_model_admin_list_proto_rawDesc = []byte{
|
||||
0x0a, 0x16, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x69,
|
||||
0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x18, 0x6d, 0x6f,
|
||||
0x64, 0x65, 0x6c, 0x5f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x5f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x70, 0x0a, 0x0f, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4d,
|
||||
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x6d,
|
||||
0x69, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x61, 0x64, 0x6d, 0x69,
|
||||
0x6e, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x53, 0x75, 0x70, 0x65, 0x72, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x53, 0x75, 0x70, 0x65, 0x72, 0x12, 0x29, 0x0a,
|
||||
0x07, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f,
|
||||
0x2e, 0x70, 0x62, 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52,
|
||||
0x07, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_model_admin_list_proto_rawDescOnce sync.Once
|
||||
file_model_admin_list_proto_rawDescData = file_model_admin_list_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_model_admin_list_proto_rawDescGZIP() []byte {
|
||||
file_model_admin_list_proto_rawDescOnce.Do(func() {
|
||||
file_model_admin_list_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_admin_list_proto_rawDescData)
|
||||
})
|
||||
return file_model_admin_list_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_model_admin_list_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_model_admin_list_proto_goTypes = []interface{}{
|
||||
(*AdminModuleList)(nil), // 0: pb.AdminModuleList
|
||||
(*AdminModule)(nil), // 1: pb.AdminModule
|
||||
}
|
||||
var file_model_admin_list_proto_depIdxs = []int32{
|
||||
1, // 0: pb.AdminModuleList.Modules:type_name -> pb.AdminModule
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
1, // [1:1] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_model_admin_list_proto_init() }
|
||||
func file_model_admin_list_proto_init() {
|
||||
if File_model_admin_list_proto != nil {
|
||||
return
|
||||
}
|
||||
file_model_admin_module_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_model_admin_list_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AdminModuleList); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_model_admin_list_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_model_admin_list_proto_goTypes,
|
||||
DependencyIndexes: file_model_admin_list_proto_depIdxs,
|
||||
MessageInfos: file_model_admin_list_proto_msgTypes,
|
||||
}.Build()
|
||||
File_model_admin_list_proto = out.File
|
||||
file_model_admin_list_proto_rawDesc = nil
|
||||
file_model_admin_list_proto_goTypes = nil
|
||||
file_model_admin_list_proto_depIdxs = nil
|
||||
}
|
||||
166
pkg/rpc/pb/model_admin_module.pb.go
Normal file
166
pkg/rpc/pb/model_admin_module.pb.go
Normal file
@@ -0,0 +1,166 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: model_admin_module.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type AdminModule struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
AllowAll bool `protobuf:"varint,1,opt,name=allowAll,proto3" json:"allowAll,omitempty"`
|
||||
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
|
||||
Actions []string `protobuf:"bytes,3,rep,name=actions,proto3" json:"actions,omitempty"`
|
||||
}
|
||||
|
||||
func (x *AdminModule) Reset() {
|
||||
*x = AdminModule{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_model_admin_module_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AdminModule) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AdminModule) ProtoMessage() {}
|
||||
|
||||
func (x *AdminModule) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_model_admin_module_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AdminModule.ProtoReflect.Descriptor instead.
|
||||
func (*AdminModule) Descriptor() ([]byte, []int) {
|
||||
return file_model_admin_module_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *AdminModule) GetAllowAll() bool {
|
||||
if x != nil {
|
||||
return x.AllowAll
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *AdminModule) GetCode() string {
|
||||
if x != nil {
|
||||
return x.Code
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AdminModule) GetActions() []string {
|
||||
if x != nil {
|
||||
return x.Actions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_model_admin_module_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_model_admin_module_proto_rawDesc = []byte{
|
||||
0x0a, 0x18, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x5f, 0x6d, 0x6f,
|
||||
0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x57,
|
||||
0x0a, 0x0b, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1a, 0x0a,
|
||||
0x08, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41, 0x6c, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52,
|
||||
0x08, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41, 0x6c, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a,
|
||||
0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07,
|
||||
0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62,
|
||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_model_admin_module_proto_rawDescOnce sync.Once
|
||||
file_model_admin_module_proto_rawDescData = file_model_admin_module_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_model_admin_module_proto_rawDescGZIP() []byte {
|
||||
file_model_admin_module_proto_rawDescOnce.Do(func() {
|
||||
file_model_admin_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_admin_module_proto_rawDescData)
|
||||
})
|
||||
return file_model_admin_module_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_model_admin_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_model_admin_module_proto_goTypes = []interface{}{
|
||||
(*AdminModule)(nil), // 0: pb.AdminModule
|
||||
}
|
||||
var file_model_admin_module_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] 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
|
||||
}
|
||||
|
||||
func init() { file_model_admin_module_proto_init() }
|
||||
func file_model_admin_module_proto_init() {
|
||||
if File_model_admin_module_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_model_admin_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AdminModule); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_model_admin_module_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_model_admin_module_proto_goTypes,
|
||||
DependencyIndexes: file_model_admin_module_proto_depIdxs,
|
||||
MessageInfos: file_model_admin_module_proto_msgTypes,
|
||||
}.Build()
|
||||
File_model_admin_module_proto = out.File
|
||||
file_model_admin_module_proto_rawDesc = nil
|
||||
file_model_admin_module_proto_goTypes = nil
|
||||
file_model_admin_module_proto_depIdxs = nil
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,9 +3,14 @@ option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "model_admin_module.proto";
|
||||
|
||||
message Admin {
|
||||
int64 id = 1;
|
||||
string fullname = 2;
|
||||
string username = 3;
|
||||
bool isOn = 4;
|
||||
bool isSuper = 5;
|
||||
int64 createdAt = 6;
|
||||
repeated AdminModule Modules = 7;
|
||||
}
|
||||
12
pkg/rpc/protos/model_admin_list.proto
Normal file
12
pkg/rpc/protos/model_admin_list.proto
Normal file
@@ -0,0 +1,12 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "model_admin_module.proto";
|
||||
|
||||
message AdminModuleList {
|
||||
int64 adminId = 1;
|
||||
bool isSuper = 2;
|
||||
repeated AdminModule Modules = 3;
|
||||
}
|
||||
10
pkg/rpc/protos/model_admin_module.proto
Normal file
10
pkg/rpc/protos/model_admin_module.proto
Normal file
@@ -0,0 +1,10 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
message AdminModule {
|
||||
bool allowAll = 1;
|
||||
string code = 2;
|
||||
repeated string actions = 3;
|
||||
}
|
||||
@@ -4,6 +4,7 @@ option go_package = "./pb";
|
||||
package pb;
|
||||
|
||||
import "model_admin.proto";
|
||||
import "model_admin_list.proto";
|
||||
import "rpc_messages.proto";
|
||||
|
||||
service AdminService {
|
||||
@@ -26,10 +27,28 @@ service AdminService {
|
||||
rpc createOrUpdateAdmin (CreateOrUpdateAdminRequest) returns (CreateOrUpdateAdminResponse);
|
||||
|
||||
// 修改管理员信息
|
||||
rpc updateAdmin (UpdateAdminRequest) returns (RPCSuccess);
|
||||
rpc updateAdminInfo (UpdateAdminInfoRequest) returns (RPCSuccess);
|
||||
|
||||
// 修改管理员登录信息
|
||||
rpc updateAdminLogin (UpdateAdminLoginRequest) returns (RPCSuccess);
|
||||
|
||||
// 获取所有管理员的权限列表
|
||||
rpc findAllAdminModules (FindAllAdminModulesRequest) returns (FindAllAdminModulesResponse);
|
||||
|
||||
// 创建管理员
|
||||
rpc createAdmin (CreateAdminRequest) returns (CreateAdminResponse);
|
||||
|
||||
// 修改管理员
|
||||
rpc updateAdmin (UpdateAdminRequest) returns (RPCSuccess);
|
||||
|
||||
// 计算管理员数量
|
||||
rpc countAllEnabledAdmins (CountAllEnabledAdminsRequest) returns (RPCCountResponse);
|
||||
|
||||
// 列出单页的管理员
|
||||
rpc listEnabledAdmins (ListEnabledAdminsRequest) returns (ListEnabledAdminsResponse);
|
||||
|
||||
// 删除管理员
|
||||
rpc deleteAdmin (DeleteAdminRequest) returns (RPCSuccess);
|
||||
}
|
||||
|
||||
// 登录
|
||||
@@ -93,7 +112,7 @@ message CreateOrUpdateAdminResponse {
|
||||
}
|
||||
|
||||
// 修改管理员信息
|
||||
message UpdateAdminRequest {
|
||||
message UpdateAdminInfoRequest {
|
||||
int64 adminId = 1;
|
||||
string fullname = 2;
|
||||
}
|
||||
@@ -104,3 +123,55 @@ message UpdateAdminLoginRequest {
|
||||
string username = 2;
|
||||
string password = 3;
|
||||
}
|
||||
|
||||
// 获取管理所有权限列表
|
||||
message FindAllAdminModulesRequest {
|
||||
|
||||
}
|
||||
|
||||
message FindAllAdminModulesResponse {
|
||||
repeated AdminModuleList adminModules = 1;
|
||||
}
|
||||
|
||||
// 创建管理员
|
||||
message CreateAdminRequest {
|
||||
string username = 1;
|
||||
string password = 2;
|
||||
string fullname = 3;
|
||||
bytes modulesJSON = 4;
|
||||
bool isSuper = 5;
|
||||
}
|
||||
|
||||
message CreateAdminResponse {
|
||||
int64 adminId = 1;
|
||||
}
|
||||
|
||||
// 修改管理员
|
||||
message UpdateAdminRequest {
|
||||
int64 adminId = 1;
|
||||
string username = 2;
|
||||
string password = 3;
|
||||
string fullname = 4;
|
||||
bytes modulesJSON = 5;
|
||||
bool isSuper = 6;
|
||||
}
|
||||
|
||||
// 计算管理员数量
|
||||
message CountAllEnabledAdminsRequest {
|
||||
|
||||
}
|
||||
|
||||
// 列出单页的管理员
|
||||
message ListEnabledAdminsRequest {
|
||||
int64 offset = 1;
|
||||
int64 size = 2;
|
||||
}
|
||||
|
||||
message ListEnabledAdminsResponse {
|
||||
repeated Admin admins = 1;
|
||||
}
|
||||
|
||||
// 删除管理员
|
||||
message DeleteAdminRequest {
|
||||
int64 adminId = 1;
|
||||
}
|
||||
8
pkg/systemconfigs/admin_module.go
Normal file
8
pkg/systemconfigs/admin_module.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package systemconfigs
|
||||
|
||||
// 用户模块权限
|
||||
type AdminModule struct {
|
||||
Code string `json:"code"` // 模块代号
|
||||
AllowAll bool `json:"allowAll"` // 允许所有的动作
|
||||
Actions []string `json:"actions"` // 只允许的动作
|
||||
}
|
||||
@@ -12,6 +12,7 @@ func DefaultLogConfig() *LogConfig {
|
||||
Unit: shared.SizeCapacityUnitGB,
|
||||
},
|
||||
Days: 30,
|
||||
CanChange: true,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,4 +22,5 @@ type LogConfig struct {
|
||||
CanClean bool `json:"canClean"` // 是否可清理
|
||||
Capacity *shared.SizeCapacity `json:"capacity"` // 容量
|
||||
Days int `json:"days"` // 自动保存天数
|
||||
CanChange bool `json:"canChange"` // 是否允许再次修改配置
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user