From 7306c753df10d126757c387f6782d58d5da20e6a Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Wed, 14 Aug 2024 20:20:08 +0800 Subject: [PATCH] enhance: Enable ReadOnly/ReadWrite/Admin Privilege Group to simplify RBAC grant progress Signed-off-by: Wei Liu --- go-api/commonpb/common.pb.go | 70 +++++++++++++++++++++--------------- proto/common.proto | 4 +++ 2 files changed, 46 insertions(+), 28 deletions(-) diff --git a/go-api/commonpb/common.pb.go b/go-api/commonpb/common.pb.go index 62ab91e..0b508f2 100644 --- a/go-api/commonpb/common.pb.go +++ b/go-api/commonpb/common.pb.go @@ -1163,6 +1163,9 @@ const ( ObjectPrivilege_PrivilegeDescribeDatabase ObjectPrivilege = 50 ObjectPrivilege_PrivilegeBackupRBAC ObjectPrivilege = 51 ObjectPrivilege_PrivilegeRestoreRBAC ObjectPrivilege = 52 + ObjectPrivilege_PrivilegeGroupReadOnly ObjectPrivilege = 53 + ObjectPrivilege_PrivilegeGroupReadWrite ObjectPrivilege = 54 + ObjectPrivilege_PrivilegeGroupAdmin ObjectPrivilege = 55 ) // Enum value maps for ObjectPrivilege. @@ -1221,6 +1224,9 @@ var ( 50: "PrivilegeDescribeDatabase", 51: "PrivilegeBackupRBAC", 52: "PrivilegeRestoreRBAC", + 53: "PrivilegeGroupReadOnly", + 54: "PrivilegeGroupReadWrite", + 55: "PrivilegeGroupAdmin", } ObjectPrivilege_value = map[string]int32{ "PrivilegeAll": 0, @@ -1276,6 +1282,9 @@ var ( "PrivilegeDescribeDatabase": 50, "PrivilegeBackupRBAC": 51, "PrivilegeRestoreRBAC": 52, + "PrivilegeGroupReadOnly": 53, + "PrivilegeGroupReadWrite": 54, + "PrivilegeGroupAdmin": 55, } ) @@ -2895,7 +2904,7 @@ var file_common_proto_rawDesc = []byte{ 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x0a, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x10, 0x02, - 0x2a, 0xa8, 0x0b, 0x0a, 0x0f, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x72, 0x69, 0x76, 0x69, + 0x2a, 0xfa, 0x0b, 0x0a, 0x0f, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x41, 0x6c, 0x6c, 0x10, 0x00, 0x12, 0x1d, 0x0a, 0x19, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, @@ -2985,33 +2994,38 @@ var file_common_proto_rawDesc = []byte{ 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x10, 0x32, 0x12, 0x17, 0x0a, 0x13, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x52, 0x42, 0x41, 0x43, 0x10, 0x33, 0x12, 0x18, 0x0a, 0x14, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x52, 0x65, - 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x42, 0x41, 0x43, 0x10, 0x34, 0x2a, 0x53, 0x0a, 0x09, 0x53, - 0x74, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x49, 0x6e, 0x69, 0x74, - 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x69, 0x6e, 0x67, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x48, 0x65, - 0x61, 0x6c, 0x74, 0x68, 0x79, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x41, 0x62, 0x6e, 0x6f, 0x72, - 0x6d, 0x61, 0x6c, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x42, 0x79, - 0x10, 0x03, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x74, 0x6f, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x10, 0x04, - 0x2a, 0x63, 0x0a, 0x09, 0x4c, 0x6f, 0x61, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x15, 0x0a, - 0x11, 0x4c, 0x6f, 0x61, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x45, 0x78, 0x69, - 0x73, 0x74, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x4c, 0x6f, 0x61, 0x64, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x4e, 0x6f, 0x74, 0x4c, 0x6f, 0x61, 0x64, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x4c, 0x6f, - 0x61, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x10, 0x02, - 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x6f, 0x61, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x61, - 0x64, 0x65, 0x64, 0x10, 0x03, 0x3a, 0x6f, 0x0a, 0x11, 0x70, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, - 0x67, 0x65, 0x5f, 0x65, 0x78, 0x74, 0x5f, 0x6f, 0x62, 0x6a, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xe9, 0x07, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6d, 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, - 0x67, 0x65, 0x45, 0x78, 0x74, 0x52, 0x0f, 0x70, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, - 0x45, 0x78, 0x74, 0x4f, 0x62, 0x6a, 0x42, 0x6d, 0x0a, 0x0e, 0x69, 0x6f, 0x2e, 0x6d, 0x69, 0x6c, - 0x76, 0x75, 0x73, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x42, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2d, 0x69, 0x6f, 0x2f, 0x6d, 0x69, - 0x6c, 0x76, 0x75, 0x73, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2d, 0x61, 0x70, - 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x70, 0x62, 0xa0, 0x01, 0x01, - 0xaa, 0x02, 0x12, 0x4d, 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x2e, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x42, 0x41, 0x43, 0x10, 0x34, 0x12, 0x1a, 0x0a, 0x16, 0x50, + 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x61, + 0x64, 0x4f, 0x6e, 0x6c, 0x79, 0x10, 0x35, 0x12, 0x1b, 0x0a, 0x17, 0x50, 0x72, 0x69, 0x76, 0x69, + 0x6c, 0x65, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x61, 0x64, 0x57, 0x72, 0x69, + 0x74, 0x65, 0x10, 0x36, 0x12, 0x17, 0x0a, 0x13, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, + 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x10, 0x37, 0x2a, 0x53, 0x0a, + 0x09, 0x53, 0x74, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x49, 0x6e, + 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x69, 0x6e, 0x67, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, + 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x41, 0x62, 0x6e, + 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x74, 0x61, 0x6e, 0x64, + 0x42, 0x79, 0x10, 0x03, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x74, 0x6f, 0x70, 0x70, 0x69, 0x6e, 0x67, + 0x10, 0x04, 0x2a, 0x63, 0x0a, 0x09, 0x4c, 0x6f, 0x61, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, + 0x15, 0x0a, 0x11, 0x4c, 0x6f, 0x61, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x45, + 0x78, 0x69, 0x73, 0x74, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x4c, 0x6f, 0x61, 0x64, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x4c, 0x6f, 0x61, 0x64, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, + 0x4c, 0x6f, 0x61, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x61, 0x64, 0x69, 0x6e, 0x67, + 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x6f, 0x61, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4c, + 0x6f, 0x61, 0x64, 0x65, 0x64, 0x10, 0x03, 0x3a, 0x6f, 0x0a, 0x11, 0x70, 0x72, 0x69, 0x76, 0x69, + 0x6c, 0x65, 0x67, 0x65, 0x5f, 0x65, 0x78, 0x74, 0x5f, 0x6f, 0x62, 0x6a, 0x12, 0x1f, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xe9, 0x07, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6d, 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x69, + 0x6c, 0x65, 0x67, 0x65, 0x45, 0x78, 0x74, 0x52, 0x0f, 0x70, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, + 0x67, 0x65, 0x45, 0x78, 0x74, 0x4f, 0x62, 0x6a, 0x42, 0x6d, 0x0a, 0x0e, 0x69, 0x6f, 0x2e, 0x6d, + 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x42, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2d, 0x69, 0x6f, 0x2f, + 0x6d, 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2d, + 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x70, 0x62, 0xa0, + 0x01, 0x01, 0xaa, 0x02, 0x12, 0x4d, 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2e, 0x43, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/common.proto b/proto/common.proto index 751c45d..0abd65b 100644 --- a/proto/common.proto +++ b/proto/common.proto @@ -412,6 +412,10 @@ enum ObjectPrivilege { PrivilegeDescribeDatabase = 50; PrivilegeBackupRBAC = 51; PrivilegeRestoreRBAC = 52; + + PrivilegeGroupReadOnly = 53; + PrivilegeGroupReadWrite = 54; + PrivilegeGroupAdmin = 55; } message PrivilegeExt {