From dab878a02079bb06bd1d48f831a0d9b802797213 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 bbff7be2..d0162250 100644 --- a/go-api/commonpb/common.pb.go +++ b/go-api/commonpb/common.pb.go @@ -1161,6 +1161,9 @@ const ( ObjectPrivilege_PrivilegeUpdateResourceGroups ObjectPrivilege = 48 ObjectPrivilege_PrivilegeAlterDatabase ObjectPrivilege = 49 ObjectPrivilege_PrivilegeDescribeDatabase ObjectPrivilege = 50 + ObjectPrivilege_PrivilegeGroupReadOnly ObjectPrivilege = 53 + ObjectPrivilege_PrivilegeGroupReadWrite ObjectPrivilege = 54 + ObjectPrivilege_PrivilegeGroupAdmin ObjectPrivilege = 55 ) // Enum value maps for ObjectPrivilege. @@ -1217,6 +1220,9 @@ var ( 48: "PrivilegeUpdateResourceGroups", 49: "PrivilegeAlterDatabase", 50: "PrivilegeDescribeDatabase", + 53: "PrivilegeGroupReadOnly", + 54: "PrivilegeGroupReadWrite", + 55: "PrivilegeGroupAdmin", } ObjectPrivilege_value = map[string]int32{ "PrivilegeAll": 0, @@ -1270,6 +1276,9 @@ var ( "PrivilegeUpdateResourceGroups": 48, "PrivilegeAlterDatabase": 49, "PrivilegeDescribeDatabase": 50, + "PrivilegeGroupReadOnly": 53, + "PrivilegeGroupReadWrite": 54, + "PrivilegeGroupAdmin": 55, } ) @@ -2889,7 +2898,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, 0xf5, 0x0a, 0x0a, 0x0f, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x72, 0x69, 0x76, 0x69, + 0x2a, 0xc7, 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, @@ -2976,33 +2985,38 @@ var file_common_proto_rawDesc = []byte{ 0x16, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x10, 0x31, 0x12, 0x1d, 0x0a, 0x19, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x44, 0x61, - 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x10, 0x32, 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, + 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x10, 0x32, 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 f9dc0c36..3db0afc7 100644 --- a/proto/common.proto +++ b/proto/common.proto @@ -410,6 +410,10 @@ enum ObjectPrivilege { PrivilegeUpdateResourceGroups = 48; PrivilegeAlterDatabase = 49; PrivilegeDescribeDatabase = 50; + + PrivilegeGroupReadOnly = 53; + PrivilegeGroupReadWrite = 54; + PrivilegeGroupAdmin = 55; } message PrivilegeExt {