Filter groups for a specific member

This commit is contained in:
Arnaud Delcasse 2022-12-05 17:18:01 +01:00
parent 7463b08c74
commit 9705c8d898
4 changed files with 99 additions and 74 deletions

View File

@ -224,6 +224,7 @@ type GetGroupsRequest struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Namespaces []string `protobuf:"bytes,6,rep,name=namespaces,proto3" json:"namespaces,omitempty"` Namespaces []string `protobuf:"bytes,6,rep,name=namespaces,proto3" json:"namespaces,omitempty"`
Member string `protobuf:"bytes,7,opt,name=member,proto3" json:"member,omitempty"`
} }
func (x *GetGroupsRequest) Reset() { func (x *GetGroupsRequest) Reset() {
@ -265,12 +266,19 @@ func (x *GetGroupsRequest) GetNamespaces() []string {
return nil return nil
} }
func (x *GetGroupsRequest) GetMember() string {
if x != nil {
return x.Member
}
return ""
}
type GetGroupsResponse struct { type GetGroupsResponse struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Groups []*Group `protobuf:"bytes,7,rep,name=groups,proto3" json:"groups,omitempty"` Groups []*Group `protobuf:"bytes,8,rep,name=groups,proto3" json:"groups,omitempty"`
} }
func (x *GetGroupsResponse) Reset() { func (x *GetGroupsResponse) Reset() {
@ -317,7 +325,7 @@ type GetGroupsBatchRequest struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Groupids []string `protobuf:"bytes,6,rep,name=groupids,proto3" json:"groupids,omitempty"` Groupids []string `protobuf:"bytes,10,rep,name=groupids,proto3" json:"groupids,omitempty"`
} }
func (x *GetGroupsBatchRequest) Reset() { func (x *GetGroupsBatchRequest) Reset() {
@ -364,7 +372,7 @@ type GetGroupsBatchResponse struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Groups []*Group `protobuf:"bytes,7,rep,name=groups,proto3" json:"groups,omitempty"` Groups []*Group `protobuf:"bytes,11,rep,name=groups,proto3" json:"groups,omitempty"`
} }
func (x *GetGroupsBatchResponse) Reset() { func (x *GetGroupsBatchResponse) Reset() {
@ -411,8 +419,8 @@ type SubscribeRequest struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Groupid string `protobuf:"bytes,8,opt,name=groupid,proto3" json:"groupid,omitempty"` Groupid string `protobuf:"bytes,20,opt,name=groupid,proto3" json:"groupid,omitempty"`
Memberid string `protobuf:"bytes,9,opt,name=memberid,proto3" json:"memberid,omitempty"` Memberid string `protobuf:"bytes,21,opt,name=memberid,proto3" json:"memberid,omitempty"`
} }
func (x *SubscribeRequest) Reset() { func (x *SubscribeRequest) Reset() {
@ -466,7 +474,7 @@ type SubscribeResponse struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Ok bool `protobuf:"varint,10,opt,name=ok,proto3" json:"ok,omitempty"` Ok bool `protobuf:"varint,22,opt,name=ok,proto3" json:"ok,omitempty"`
} }
func (x *SubscribeResponse) Reset() { func (x *SubscribeResponse) Reset() {
@ -513,8 +521,8 @@ type UnsubscribeRequest struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Groupid string `protobuf:"bytes,8,opt,name=groupid,proto3" json:"groupid,omitempty"` Groupid string `protobuf:"bytes,30,opt,name=groupid,proto3" json:"groupid,omitempty"`
Memberid string `protobuf:"bytes,9,opt,name=memberid,proto3" json:"memberid,omitempty"` Memberid string `protobuf:"bytes,31,opt,name=memberid,proto3" json:"memberid,omitempty"`
} }
func (x *UnsubscribeRequest) Reset() { func (x *UnsubscribeRequest) Reset() {
@ -568,7 +576,7 @@ type UnsubscribeResponse struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Ok bool `protobuf:"varint,10,opt,name=ok,proto3" json:"ok,omitempty"` Ok bool `protobuf:"varint,32,opt,name=ok,proto3" json:"ok,omitempty"`
} }
func (x *UnsubscribeResponse) Reset() { func (x *UnsubscribeResponse) Reset() {
@ -628,62 +636,63 @@ var file_groupsmanagement_proto_rawDesc = []byte{
0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0x30, 0x0a, 0x10, 0x47, 0x65, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0x30, 0x0a, 0x10, 0x47, 0x65,
0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c,
0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e,
0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x32, 0x0a, 0x10, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x4a, 0x0a, 0x10,
0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x06, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x06,
0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73,
0x22, 0x33, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x33, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x47,
0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a,
0x72, 0x6f, 0x75, 0x70, 0x73, 0x22, 0x33, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x06, 0x2e,
0x70, 0x73, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x22, 0x33, 0x0a,
0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x15, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52,
0x52, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x64, 0x73, 0x22, 0x38, 0x0a, 0x16, 0x47, 0x65, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69,
0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x64, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x07, 0x64, 0x73, 0x22, 0x38, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x06, 0x67, 0x72, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x06,
0x6f, 0x75, 0x70, 0x73, 0x22, 0x48, 0x0a, 0x10, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x47,
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x22, 0x48, 0x0a, 0x10,
0x70, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x69, 0x64, 0x18, 0x09, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28,
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x69, 0x64, 0x22, 0x23, 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65,
0x0a, 0x11, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6d, 0x62, 0x65, 0x72, 0x69, 0x64, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65,
0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x6d, 0x62, 0x65, 0x72, 0x69, 0x64, 0x22, 0x23, 0x0a, 0x11, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72,
0x02, 0x6f, 0x6b, 0x22, 0x4a, 0x0a, 0x12, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f,
0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x6b, 0x18, 0x16, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x22, 0x4a, 0x0a, 0x12, 0x55,
0x75, 0x70, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x70, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x69, 0x64, 0x18, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x64, 0x18, 0x1e, 0x20, 0x01,
0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x69, 0x64, 0x22, 0x28, 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d,
0x25, 0x0a, 0x13, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x69, 0x64, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x69, 0x64, 0x22, 0x25, 0x0a, 0x13, 0x55, 0x6e, 0x73, 0x75, 0x62,
0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x32, 0xe5, 0x02, 0x0a, 0x10, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e,
0x73, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x31, 0x0a, 0x08, 0x41, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x20, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x32, 0xe5,
0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x10, 0x2e, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x02, 0x0a, 0x10, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d,
0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x41, 0x64, 0x64, 0x47, 0x65, 0x6e, 0x74, 0x12, 0x31, 0x0a, 0x08, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12,
0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x31, 0x10, 0x2e, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x0a, 0x08, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x74, 0x1a, 0x11, 0x2e, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70,
0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x47, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f,
0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x75, 0x70, 0x12, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71,
0x00, 0x12, 0x34, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0x11, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52,
0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x09, 0x47, 0x65, 0x74,
0x74, 0x1a, 0x12, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x73, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0x11, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x47, 0x65, 0x74, 0x47,
0x6f, 0x75, 0x70, 0x73, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x16, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x43, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x61, 0x74, 0x63,
0x74, 0x1a, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x61, 0x74, 0x68, 0x12, 0x16, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x61, 0x74,
0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x09, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x47,
0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x11, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x53, 0x73, 0x65, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x09, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62,
0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x65, 0x12, 0x11, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71,
0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0b, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65,
0x65, 0x12, 0x13, 0x2e, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0b, 0x55, 0x6e,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x13, 0x2e, 0x55, 0x6e, 0x73, 0x75,
0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x39, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14,
0x5a, 0x37, 0x67, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2e, 0x69, 0x6f, 0x2f, 0x2e, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70,
0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x39, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x2e, 0x63, 0x6f,
0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2d, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x6f, 0x70, 0x67, 0x6f, 0x2e, 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2d, 0x70,
0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2d, 0x6d,
0x33, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x61, 0x70,
0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View File

@ -34,34 +34,35 @@ message GetGroupResponse {
message GetGroupsRequest { message GetGroupsRequest {
repeated string namespaces = 6; repeated string namespaces = 6;
string member = 7;
} }
message GetGroupsResponse { message GetGroupsResponse {
repeated Group groups = 7; repeated Group groups = 8;
} }
message GetGroupsBatchRequest { message GetGroupsBatchRequest {
repeated string groupids = 6; repeated string groupids = 10;
} }
message GetGroupsBatchResponse { message GetGroupsBatchResponse {
repeated Group groups = 7; repeated Group groups = 11;
} }
message SubscribeRequest { message SubscribeRequest {
string groupid = 8; string groupid = 20;
string memberid = 9; string memberid = 21;
} }
message SubscribeResponse { message SubscribeResponse {
bool ok = 10; bool ok = 22;
} }
message UnsubscribeRequest { message UnsubscribeRequest {
string groupid = 11; string groupid = 30;
string memberid = 12; string memberid = 31;
} }
message UnsubscribeResponse { message UnsubscribeResponse {
bool ok = 13; bool ok = 32;
} }

View File

@ -53,7 +53,7 @@ func (s GroupsManagementServerImpl) GetGroup(ctx context.Context, req *GetGroupR
return &GetGroupResponse{Group: response}, nil return &GetGroupResponse{Group: response}, nil
} }
func (s GroupsManagementServerImpl) GetGroups(ctx context.Context, req *GetGroupsRequest) (*GetGroupsResponse, error) { func (s GroupsManagementServerImpl) GetGroups(ctx context.Context, req *GetGroupsRequest) (*GetGroupsResponse, error) {
responses, err := s.handler.GetGroups(req.Namespaces) responses, err := s.handler.GetGroups(req.Namespaces, req.Member)
if err != nil { if err != nil {
return nil, status.Errorf(codes.NotFound, "could not get groups : %v", err) return nil, status.Errorf(codes.NotFound, "could not get groups : %v", err)
} }

View File

@ -25,8 +25,23 @@ func (h GroupsManagementHandler) GetGroup(id string) (group *storage.Group, err
return return
} }
func (h GroupsManagementHandler) GetGroups(namespaces []string) (groups []storage.Group, err error) { func (h GroupsManagementHandler) GetGroups(namespaces []string, member string) (groups []storage.Group, err error) {
groups, err = h.storage.GetGroups(namespaces) groups = []storage.Group{}
g, err := h.storage.GetGroups(namespaces)
if err != nil {
return
}
if member == "" {
return g, nil
}
for _, group := range g {
for _, m := range group.Members {
if m == member {
groups = append(groups, group)
break
}
}
}
return return
} }