From 424aa7cf802c79848261470063ed7ccaa97b35d6 Mon Sep 17 00:00:00 2001 From: Steve Munene <61874077+nyagamunene@users.noreply.github.com> Date: Fri, 21 Jun 2024 11:07:52 +0300 Subject: [PATCH] MG-2216 - Rename delete policy function (#2218) Signed-off-by: nyagamunene --- auth.pb.go | 827 +++++++++++++++++++------------- auth.proto | 19 +- auth/api/grpc/client.go | 62 +-- auth/api/grpc/endpoint.go | 10 +- auth/api/grpc/endpoint_test.go | 88 ++-- auth/api/grpc/responses.go | 2 +- auth/api/grpc/server.go | 54 +-- auth/api/logging.go | 8 +- auth/api/metrics.go | 8 +- auth/mocks/agent.go | 6 +- auth/mocks/auth_client.go | 4 +- auth/mocks/authz.go | 6 +- auth/mocks/service.go | 6 +- auth/policies.go | 10 +- auth/service.go | 4 +- auth/service_test.go | 28 +- auth/spicedb/policies.go | 2 +- auth/tracing/tracing.go | 4 +- auth_grpc.pb.go | 58 +-- cli/domains.go | 4 +- internal/groups/service.go | 8 +- internal/groups/service_test.go | 200 ++++---- pkg/sdk/go/channels_test.go | 124 ++--- pkg/sdk/go/things_test.go | 2 +- pkg/sdk/go/users_test.go | 2 +- things/service.go | 6 +- things/service_test.go | 34 +- things/standalone/standalone.go | 2 +- users/service.go | 2 +- users/service_test.go | 162 +++---- 30 files changed, 960 insertions(+), 792 deletions(-) diff --git a/auth.pb.go b/auth.pb.go index a73d722adf..60fb3cdf9b 100644 --- a/auth.pb.go +++ b/auth.pb.go @@ -743,7 +743,7 @@ func (x *AddPoliciesRes) GetAdded() bool { return false } -type DeletePolicyReq struct { +type DeletePolicyFilterReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -760,8 +760,8 @@ type DeletePolicyReq struct { ObjectType string `protobuf:"bytes,10,opt,name=object_type,json=objectType,proto3" json:"object_type,omitempty"` } -func (x *DeletePolicyReq) Reset() { - *x = DeletePolicyReq{} +func (x *DeletePolicyFilterReq) Reset() { + *x = DeletePolicyFilterReq{} if protoimpl.UnsafeEnabled { mi := &file_auth_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -769,13 +769,13 @@ func (x *DeletePolicyReq) Reset() { } } -func (x *DeletePolicyReq) String() string { +func (x *DeletePolicyFilterReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*DeletePolicyReq) ProtoMessage() {} +func (*DeletePolicyFilterReq) ProtoMessage() {} -func (x *DeletePolicyReq) ProtoReflect() protoreflect.Message { +func (x *DeletePolicyFilterReq) ProtoReflect() protoreflect.Message { mi := &file_auth_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -787,81 +787,128 @@ func (x *DeletePolicyReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use DeletePolicyReq.ProtoReflect.Descriptor instead. -func (*DeletePolicyReq) Descriptor() ([]byte, []int) { +// Deprecated: Use DeletePolicyFilterReq.ProtoReflect.Descriptor instead. +func (*DeletePolicyFilterReq) Descriptor() ([]byte, []int) { return file_auth_proto_rawDescGZIP(), []int{11} } -func (x *DeletePolicyReq) GetDomain() string { +func (x *DeletePolicyFilterReq) GetDomain() string { if x != nil { return x.Domain } return "" } -func (x *DeletePolicyReq) GetSubjectType() string { +func (x *DeletePolicyFilterReq) GetSubjectType() string { if x != nil { return x.SubjectType } return "" } -func (x *DeletePolicyReq) GetSubjectRelation() string { +func (x *DeletePolicyFilterReq) GetSubjectRelation() string { if x != nil { return x.SubjectRelation } return "" } -func (x *DeletePolicyReq) GetSubjectKind() string { +func (x *DeletePolicyFilterReq) GetSubjectKind() string { if x != nil { return x.SubjectKind } return "" } -func (x *DeletePolicyReq) GetSubject() string { +func (x *DeletePolicyFilterReq) GetSubject() string { if x != nil { return x.Subject } return "" } -func (x *DeletePolicyReq) GetRelation() string { +func (x *DeletePolicyFilterReq) GetRelation() string { if x != nil { return x.Relation } return "" } -func (x *DeletePolicyReq) GetPermission() string { +func (x *DeletePolicyFilterReq) GetPermission() string { if x != nil { return x.Permission } return "" } -func (x *DeletePolicyReq) GetObject() string { +func (x *DeletePolicyFilterReq) GetObject() string { if x != nil { return x.Object } return "" } -func (x *DeletePolicyReq) GetObjectKind() string { +func (x *DeletePolicyFilterReq) GetObjectKind() string { if x != nil { return x.ObjectKind } return "" } -func (x *DeletePolicyReq) GetObjectType() string { +func (x *DeletePolicyFilterReq) GetObjectType() string { if x != nil { return x.ObjectType } return "" } +type DeletePolicyFilterRes struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Deleted bool `protobuf:"varint,1,opt,name=deleted,proto3" json:"deleted,omitempty"` +} + +func (x *DeletePolicyFilterRes) Reset() { + *x = DeletePolicyFilterRes{} + if protoimpl.UnsafeEnabled { + mi := &file_auth_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeletePolicyFilterRes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeletePolicyFilterRes) ProtoMessage() {} + +func (x *DeletePolicyFilterRes) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[12] + 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 DeletePolicyFilterRes.ProtoReflect.Descriptor instead. +func (*DeletePolicyFilterRes) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{12} +} + +func (x *DeletePolicyFilterRes) GetDeleted() bool { + if x != nil { + return x.Deleted + } + return false +} + type DeletePoliciesReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -873,7 +920,7 @@ type DeletePoliciesReq struct { func (x *DeletePoliciesReq) Reset() { *x = DeletePoliciesReq{} if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[12] + mi := &file_auth_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -886,7 +933,7 @@ func (x *DeletePoliciesReq) String() string { func (*DeletePoliciesReq) ProtoMessage() {} func (x *DeletePoliciesReq) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[12] + mi := &file_auth_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -899,7 +946,7 @@ func (x *DeletePoliciesReq) ProtoReflect() protoreflect.Message { // Deprecated: Use DeletePoliciesReq.ProtoReflect.Descriptor instead. func (*DeletePoliciesReq) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{12} + return file_auth_proto_rawDescGZIP(), []int{13} } func (x *DeletePoliciesReq) GetDeletePoliciesReq() []*DeletePolicyReq { @@ -909,31 +956,40 @@ func (x *DeletePoliciesReq) GetDeletePoliciesReq() []*DeletePolicyReq { return nil } -type DeletePolicyRes struct { +type DeletePolicyReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Deleted bool `protobuf:"varint,1,opt,name=deleted,proto3" json:"deleted,omitempty"` + Domain string `protobuf:"bytes,1,opt,name=domain,proto3" json:"domain,omitempty"` + SubjectType string `protobuf:"bytes,2,opt,name=subject_type,json=subjectType,proto3" json:"subject_type,omitempty"` + SubjectRelation string `protobuf:"bytes,3,opt,name=subject_relation,json=subjectRelation,proto3" json:"subject_relation,omitempty"` + SubjectKind string `protobuf:"bytes,4,opt,name=subject_kind,json=subjectKind,proto3" json:"subject_kind,omitempty"` + Subject string `protobuf:"bytes,5,opt,name=subject,proto3" json:"subject,omitempty"` + Relation string `protobuf:"bytes,6,opt,name=relation,proto3" json:"relation,omitempty"` + Permission string `protobuf:"bytes,7,opt,name=permission,proto3" json:"permission,omitempty"` + Object string `protobuf:"bytes,8,opt,name=object,proto3" json:"object,omitempty"` + ObjectKind string `protobuf:"bytes,9,opt,name=object_kind,json=objectKind,proto3" json:"object_kind,omitempty"` + ObjectType string `protobuf:"bytes,10,opt,name=object_type,json=objectType,proto3" json:"object_type,omitempty"` } -func (x *DeletePolicyRes) Reset() { - *x = DeletePolicyRes{} +func (x *DeletePolicyReq) Reset() { + *x = DeletePolicyReq{} if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[13] + mi := &file_auth_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *DeletePolicyRes) String() string { +func (x *DeletePolicyReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*DeletePolicyRes) ProtoMessage() {} +func (*DeletePolicyReq) ProtoMessage() {} -func (x *DeletePolicyRes) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[13] +func (x *DeletePolicyReq) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -944,16 +1000,79 @@ func (x *DeletePolicyRes) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use DeletePolicyRes.ProtoReflect.Descriptor instead. -func (*DeletePolicyRes) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{13} +// Deprecated: Use DeletePolicyReq.ProtoReflect.Descriptor instead. +func (*DeletePolicyReq) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{14} } -func (x *DeletePolicyRes) GetDeleted() bool { +func (x *DeletePolicyReq) GetDomain() string { if x != nil { - return x.Deleted + return x.Domain } - return false + return "" +} + +func (x *DeletePolicyReq) GetSubjectType() string { + if x != nil { + return x.SubjectType + } + return "" +} + +func (x *DeletePolicyReq) GetSubjectRelation() string { + if x != nil { + return x.SubjectRelation + } + return "" +} + +func (x *DeletePolicyReq) GetSubjectKind() string { + if x != nil { + return x.SubjectKind + } + return "" +} + +func (x *DeletePolicyReq) GetSubject() string { + if x != nil { + return x.Subject + } + return "" +} + +func (x *DeletePolicyReq) GetRelation() string { + if x != nil { + return x.Relation + } + return "" +} + +func (x *DeletePolicyReq) GetPermission() string { + if x != nil { + return x.Permission + } + return "" +} + +func (x *DeletePolicyReq) GetObject() string { + if x != nil { + return x.Object + } + return "" +} + +func (x *DeletePolicyReq) GetObjectKind() string { + if x != nil { + return x.ObjectKind + } + return "" +} + +func (x *DeletePolicyReq) GetObjectType() string { + if x != nil { + return x.ObjectType + } + return "" } type DeletePoliciesRes struct { @@ -967,7 +1086,7 @@ type DeletePoliciesRes struct { func (x *DeletePoliciesRes) Reset() { *x = DeletePoliciesRes{} if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[14] + mi := &file_auth_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -980,7 +1099,7 @@ func (x *DeletePoliciesRes) String() string { func (*DeletePoliciesRes) ProtoMessage() {} func (x *DeletePoliciesRes) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[14] + mi := &file_auth_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -993,7 +1112,7 @@ func (x *DeletePoliciesRes) ProtoReflect() protoreflect.Message { // Deprecated: Use DeletePoliciesRes.ProtoReflect.Descriptor instead. func (*DeletePoliciesRes) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{14} + return file_auth_proto_rawDescGZIP(), []int{15} } func (x *DeletePoliciesRes) GetDeleted() bool { @@ -1023,7 +1142,7 @@ type ListObjectsReq struct { func (x *ListObjectsReq) Reset() { *x = ListObjectsReq{} if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[15] + mi := &file_auth_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1036,7 +1155,7 @@ func (x *ListObjectsReq) String() string { func (*ListObjectsReq) ProtoMessage() {} func (x *ListObjectsReq) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[15] + mi := &file_auth_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1049,7 +1168,7 @@ func (x *ListObjectsReq) ProtoReflect() protoreflect.Message { // Deprecated: Use ListObjectsReq.ProtoReflect.Descriptor instead. func (*ListObjectsReq) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{15} + return file_auth_proto_rawDescGZIP(), []int{16} } func (x *ListObjectsReq) GetDomain() string { @@ -1134,7 +1253,7 @@ type ListObjectsRes struct { func (x *ListObjectsRes) Reset() { *x = ListObjectsRes{} if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[16] + mi := &file_auth_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1147,7 +1266,7 @@ func (x *ListObjectsRes) String() string { func (*ListObjectsRes) ProtoMessage() {} func (x *ListObjectsRes) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[16] + mi := &file_auth_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1160,7 +1279,7 @@ func (x *ListObjectsRes) ProtoReflect() protoreflect.Message { // Deprecated: Use ListObjectsRes.ProtoReflect.Descriptor instead. func (*ListObjectsRes) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{16} + return file_auth_proto_rawDescGZIP(), []int{17} } func (x *ListObjectsRes) GetPolicies() []string { @@ -1196,7 +1315,7 @@ type CountObjectsReq struct { func (x *CountObjectsReq) Reset() { *x = CountObjectsReq{} if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[17] + mi := &file_auth_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1209,7 +1328,7 @@ func (x *CountObjectsReq) String() string { func (*CountObjectsReq) ProtoMessage() {} func (x *CountObjectsReq) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[17] + mi := &file_auth_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1222,7 +1341,7 @@ func (x *CountObjectsReq) ProtoReflect() protoreflect.Message { // Deprecated: Use CountObjectsReq.ProtoReflect.Descriptor instead. func (*CountObjectsReq) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{17} + return file_auth_proto_rawDescGZIP(), []int{18} } func (x *CountObjectsReq) GetDomain() string { @@ -1299,7 +1418,7 @@ type CountObjectsRes struct { func (x *CountObjectsRes) Reset() { *x = CountObjectsRes{} if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[18] + mi := &file_auth_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1312,7 +1431,7 @@ func (x *CountObjectsRes) String() string { func (*CountObjectsRes) ProtoMessage() {} func (x *CountObjectsRes) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[18] + mi := &file_auth_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1325,7 +1444,7 @@ func (x *CountObjectsRes) ProtoReflect() protoreflect.Message { // Deprecated: Use CountObjectsRes.ProtoReflect.Descriptor instead. func (*CountObjectsRes) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{18} + return file_auth_proto_rawDescGZIP(), []int{19} } func (x *CountObjectsRes) GetCount() uint64 { @@ -1355,7 +1474,7 @@ type ListSubjectsReq struct { func (x *ListSubjectsReq) Reset() { *x = ListSubjectsReq{} if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[19] + mi := &file_auth_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1368,7 +1487,7 @@ func (x *ListSubjectsReq) String() string { func (*ListSubjectsReq) ProtoMessage() {} func (x *ListSubjectsReq) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[19] + mi := &file_auth_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1381,7 +1500,7 @@ func (x *ListSubjectsReq) ProtoReflect() protoreflect.Message { // Deprecated: Use ListSubjectsReq.ProtoReflect.Descriptor instead. func (*ListSubjectsReq) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{19} + return file_auth_proto_rawDescGZIP(), []int{20} } func (x *ListSubjectsReq) GetDomain() string { @@ -1466,7 +1585,7 @@ type ListSubjectsRes struct { func (x *ListSubjectsRes) Reset() { *x = ListSubjectsRes{} if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[20] + mi := &file_auth_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1479,7 +1598,7 @@ func (x *ListSubjectsRes) String() string { func (*ListSubjectsRes) ProtoMessage() {} func (x *ListSubjectsRes) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[20] + mi := &file_auth_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1492,7 +1611,7 @@ func (x *ListSubjectsRes) ProtoReflect() protoreflect.Message { // Deprecated: Use ListSubjectsRes.ProtoReflect.Descriptor instead. func (*ListSubjectsRes) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{20} + return file_auth_proto_rawDescGZIP(), []int{21} } func (x *ListSubjectsRes) GetPolicies() []string { @@ -1528,7 +1647,7 @@ type CountSubjectsReq struct { func (x *CountSubjectsReq) Reset() { *x = CountSubjectsReq{} if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[21] + mi := &file_auth_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1541,7 +1660,7 @@ func (x *CountSubjectsReq) String() string { func (*CountSubjectsReq) ProtoMessage() {} func (x *CountSubjectsReq) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[21] + mi := &file_auth_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1554,7 +1673,7 @@ func (x *CountSubjectsReq) ProtoReflect() protoreflect.Message { // Deprecated: Use CountSubjectsReq.ProtoReflect.Descriptor instead. func (*CountSubjectsReq) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{21} + return file_auth_proto_rawDescGZIP(), []int{22} } func (x *CountSubjectsReq) GetDomain() string { @@ -1631,7 +1750,7 @@ type CountSubjectsRes struct { func (x *CountSubjectsRes) Reset() { *x = CountSubjectsRes{} if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[22] + mi := &file_auth_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1644,7 +1763,7 @@ func (x *CountSubjectsRes) String() string { func (*CountSubjectsRes) ProtoMessage() {} func (x *CountSubjectsRes) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[22] + mi := &file_auth_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1657,7 +1776,7 @@ func (x *CountSubjectsRes) ProtoReflect() protoreflect.Message { // Deprecated: Use CountSubjectsRes.ProtoReflect.Descriptor instead. func (*CountSubjectsRes) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{22} + return file_auth_proto_rawDescGZIP(), []int{23} } func (x *CountSubjectsRes) GetCount() uint64 { @@ -1684,7 +1803,7 @@ type ListPermissionsReq struct { func (x *ListPermissionsReq) Reset() { *x = ListPermissionsReq{} if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[23] + mi := &file_auth_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1697,7 +1816,7 @@ func (x *ListPermissionsReq) String() string { func (*ListPermissionsReq) ProtoMessage() {} func (x *ListPermissionsReq) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[23] + mi := &file_auth_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1710,7 +1829,7 @@ func (x *ListPermissionsReq) ProtoReflect() protoreflect.Message { // Deprecated: Use ListPermissionsReq.ProtoReflect.Descriptor instead. func (*ListPermissionsReq) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{23} + return file_auth_proto_rawDescGZIP(), []int{24} } func (x *ListPermissionsReq) GetDomain() string { @@ -1779,7 +1898,7 @@ type ListPermissionsRes struct { func (x *ListPermissionsRes) Reset() { *x = ListPermissionsRes{} if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[24] + mi := &file_auth_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1792,7 +1911,7 @@ func (x *ListPermissionsRes) String() string { func (*ListPermissionsRes) ProtoMessage() {} func (x *ListPermissionsRes) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[24] + mi := &file_auth_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1805,7 +1924,7 @@ func (x *ListPermissionsRes) ProtoReflect() protoreflect.Message { // Deprecated: Use ListPermissionsRes.ProtoReflect.Descriptor instead. func (*ListPermissionsRes) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{24} + return file_auth_proto_rawDescGZIP(), []int{25} } func (x *ListPermissionsRes) GetDomain() string { @@ -1943,66 +2062,62 @@ var file_auth_proto_rawDesc = []byte{ 0x64, 0x64, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x61, 0x64, 0x64, 0x65, 0x64, 0x22, 0x26, 0x0a, 0x0e, 0x41, 0x64, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x64, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x05, 0x61, 0x64, 0x64, 0x65, 0x64, 0x22, 0xca, 0x02, 0x0a, 0x0f, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, - 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, - 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x75, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x73, 0x75, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6b, - 0x69, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x75, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, - 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6b, - 0x69, 0x6e, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, 0x5e, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x12, 0x49, 0x0a, 0x11, 0x64, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, - 0x61, 0x6c, 0x61, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x52, 0x65, 0x71, 0x52, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, - 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x22, 0x2b, 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x64, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x64, 0x22, 0x2d, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, - 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x64, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x64, 0x22, 0xc1, 0x02, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x73, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x21, 0x0a, - 0x0c, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x29, 0x0a, 0x10, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x6c, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x75, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, - 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x6e, 0x65, - 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x52, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x69, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, - 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xac, 0x02, 0x0a, 0x0f, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x12, 0x16, + 0x28, 0x08, 0x52, 0x05, 0x61, 0x64, 0x64, 0x65, 0x64, 0x22, 0xd0, 0x02, 0x0a, 0x15, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x73, + 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, + 0x0a, 0x10, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x75, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x18, 0x0a, 0x07, + 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, + 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, 0x31, 0x0a, 0x15, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x46, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x22, + 0x5e, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, + 0x73, 0x52, 0x65, 0x71, 0x12, 0x49, 0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, + 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x1b, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x52, 0x11, 0x64, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x22, + 0xca, 0x02, 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x73, + 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, + 0x0a, 0x10, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x75, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x18, 0x0a, 0x07, + 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, + 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, 0x2d, 0x0a, 0x11, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, + 0x73, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x07, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x22, 0xc1, 0x02, 0x0a, 0x0e, + 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x75, @@ -2020,11 +2135,84 @@ var file_auth_proto_rawDesc = []byte{ 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, - 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x27, 0x0a, 0x0f, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x22, 0xc2, 0x02, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, + 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, + 0x69, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, + 0x52, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, + 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x24, 0x0a, + 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x22, 0xac, 0x02, 0x0a, 0x0f, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, + 0x21, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, + 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, + 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0d, + 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x22, 0x27, 0x0a, 0x0f, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xc2, 0x02, 0x0a, 0x0f, + 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x12, + 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, + 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x73, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x6c, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, + 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x70, + 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, + 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, + 0x6d, 0x69, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, + 0x22, 0x53, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, + 0x52, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, + 0x24, 0x0a, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xad, 0x02, 0x0a, 0x10, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x53, + 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, + 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, + 0x69, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, + 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, + 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x65, 0x72, 0x6d, + 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1f, + 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x24, 0x0a, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x28, 0x0a, 0x10, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, + 0xfc, 0x01, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, @@ -2032,151 +2220,105 @@ var file_auth_proto_rawDesc = []byte{ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, - 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x6e, - 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x53, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x53, - 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, - 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, - 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xad, 0x02, 0x0a, - 0x10, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, - 0x71, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x75, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x10, - 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, - 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, - 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, - 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, - 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, - 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x28, 0x0a, 0x10, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, - 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xfc, 0x01, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x50, - 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, - 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, - 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x75, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x73, 0x75, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x16, 0x0a, - 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2d, 0x0a, 0x12, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, - 0x5f, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x11, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xef, 0x01, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x65, - 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, - 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, - 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x75, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x73, 0x75, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x65, 0x72, 0x6d, - 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x32, 0x51, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x7a, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x65, 0x12, 0x18, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, - 0x61, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x18, - 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x41, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x73, 0x22, 0x00, 0x32, 0xc6, 0x08, 0x0a, 0x0b, 0x41, - 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x05, 0x49, 0x73, - 0x73, 0x75, 0x65, 0x12, 0x14, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, - 0x2e, 0x49, 0x73, 0x73, 0x75, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x6d, 0x61, 0x67, 0x69, - 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x00, 0x12, 0x36, - 0x0a, 0x07, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x12, 0x16, 0x2e, 0x6d, 0x61, 0x67, 0x69, - 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x52, 0x65, - 0x71, 0x1a, 0x11, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x08, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x66, 0x79, 0x12, 0x17, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, - 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x6d, 0x61, - 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x7a, 0x65, 0x12, 0x18, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, - 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x18, 0x2e, + 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1f, + 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x2d, 0x0a, 0x12, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x66, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xef, + 0x01, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x21, 0x0a, + 0x0c, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x29, 0x0a, 0x10, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x6c, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x75, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, + 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1f, 0x0a, + 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, + 0x0a, 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, + 0x32, 0x51, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x41, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x12, 0x18, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x09, 0x41, 0x64, 0x64, - 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x18, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, - 0x61, 0x6c, 0x61, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, - 0x1a, 0x18, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x41, 0x64, - 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x0b, - 0x41, 0x64, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x1a, 0x2e, 0x6d, 0x61, - 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x6f, 0x6c, 0x69, - 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, - 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, - 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x1b, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, - 0x6c, 0x61, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, - 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x73, 0x22, - 0x00, 0x12, 0x50, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, - 0x69, 0x65, 0x73, 0x12, 0x1d, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, - 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, - 0x65, 0x71, 0x1a, 0x1d, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, - 0x73, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x73, 0x12, 0x1a, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, - 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x1a, - 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, - 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0e, - 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x6c, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x1a, - 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, - 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e, 0x6d, 0x61, 0x67, - 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0c, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x1b, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, - 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, - 0x6c, 0x61, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, - 0x65, 0x73, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x73, 0x12, 0x1b, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, - 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, - 0x71, 0x1a, 0x1b, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x22, 0x00, - 0x12, 0x4d, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x62, 0x6a, 0x65, + 0x72, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x18, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x52, 0x65, + 0x73, 0x22, 0x00, 0x32, 0xd8, 0x08, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x05, 0x49, 0x73, 0x73, 0x75, 0x65, 0x12, 0x14, 0x2e, 0x6d, + 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x49, 0x73, 0x73, 0x75, 0x65, 0x52, + 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x07, 0x52, 0x65, 0x66, 0x72, 0x65, + 0x73, 0x68, 0x12, 0x16, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, + 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x6d, 0x61, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x00, 0x12, + 0x3e, 0x0a, 0x08, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x79, 0x12, 0x17, 0x2e, 0x6d, 0x61, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, + 0x61, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, + 0x41, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x12, 0x18, 0x2e, 0x6d, + 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x18, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x61, 0x6c, 0x61, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x73, + 0x22, 0x00, 0x12, 0x41, 0x0a, 0x09, 0x41, 0x64, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, + 0x18, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x41, 0x64, 0x64, + 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x18, 0x2e, 0x6d, 0x61, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x50, 0x6f, 0x6c, 0x69, + 0x63, 0x69, 0x65, 0x73, 0x12, 0x1a, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, + 0x61, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, + 0x1a, 0x1a, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x41, 0x64, + 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, 0x5c, + 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x46, 0x69, + 0x6c, 0x74, 0x65, 0x72, 0x12, 0x21, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, + 0x61, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x46, 0x69, + 0x6c, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x21, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, 0x50, 0x0a, 0x0e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x1d, + 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x1d, 0x2e, + 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, 0x47, + 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x1a, 0x2e, + 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e, 0x6d, 0x61, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x41, + 0x6c, 0x6c, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x1a, 0x2e, 0x6d, 0x61, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, + 0x6c, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, + 0x73, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x1b, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, - 0x1a, 0x1b, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, - 0x4d, 0x0a, 0x0d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, - 0x12, 0x1c, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x1c, - 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, 0x53, - 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x73, 0x12, 0x1e, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, - 0x71, 0x1a, 0x1e, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, - 0x73, 0x22, 0x00, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2f, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, - 0x61, 0x6c, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, + 0x1a, 0x1b, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, + 0x4a, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, + 0x1b, 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x6d, + 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, 0x4d, 0x0a, 0x0f, 0x4c, + 0x69, 0x73, 0x74, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x1b, + 0x2e, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x6d, 0x61, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, 0x4d, 0x0a, 0x0d, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x1c, 0x2e, 0x6d, 0x61, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x1c, 0x2e, 0x6d, 0x61, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x75, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, 0x53, 0x0a, 0x0f, 0x4c, 0x69, 0x73, + 0x74, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1e, 0x2e, 0x6d, + 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x65, + 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x1e, 0x2e, 0x6d, + 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x65, + 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x22, 0x00, 0x42, 0x0e, + 0x5a, 0x0c, 0x2e, 0x2f, 0x6d, 0x61, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x6c, 0x61, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2191,37 +2333,38 @@ func file_auth_proto_rawDescGZIP() []byte { return file_auth_proto_rawDescData } -var file_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 25) +var file_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 26) var file_auth_proto_goTypes = []interface{}{ - (*Token)(nil), // 0: magistrala.Token - (*IdentityReq)(nil), // 1: magistrala.IdentityReq - (*IdentityRes)(nil), // 2: magistrala.IdentityRes - (*IssueReq)(nil), // 3: magistrala.IssueReq - (*RefreshReq)(nil), // 4: magistrala.RefreshReq - (*AuthorizeReq)(nil), // 5: magistrala.AuthorizeReq - (*AuthorizeRes)(nil), // 6: magistrala.AuthorizeRes - (*AddPolicyReq)(nil), // 7: magistrala.AddPolicyReq - (*AddPoliciesReq)(nil), // 8: magistrala.AddPoliciesReq - (*AddPolicyRes)(nil), // 9: magistrala.AddPolicyRes - (*AddPoliciesRes)(nil), // 10: magistrala.AddPoliciesRes - (*DeletePolicyReq)(nil), // 11: magistrala.DeletePolicyReq - (*DeletePoliciesReq)(nil), // 12: magistrala.DeletePoliciesReq - (*DeletePolicyRes)(nil), // 13: magistrala.DeletePolicyRes - (*DeletePoliciesRes)(nil), // 14: magistrala.DeletePoliciesRes - (*ListObjectsReq)(nil), // 15: magistrala.ListObjectsReq - (*ListObjectsRes)(nil), // 16: magistrala.ListObjectsRes - (*CountObjectsReq)(nil), // 17: magistrala.CountObjectsReq - (*CountObjectsRes)(nil), // 18: magistrala.CountObjectsRes - (*ListSubjectsReq)(nil), // 19: magistrala.ListSubjectsReq - (*ListSubjectsRes)(nil), // 20: magistrala.ListSubjectsRes - (*CountSubjectsReq)(nil), // 21: magistrala.CountSubjectsReq - (*CountSubjectsRes)(nil), // 22: magistrala.CountSubjectsRes - (*ListPermissionsReq)(nil), // 23: magistrala.ListPermissionsReq - (*ListPermissionsRes)(nil), // 24: magistrala.ListPermissionsRes + (*Token)(nil), // 0: magistrala.Token + (*IdentityReq)(nil), // 1: magistrala.IdentityReq + (*IdentityRes)(nil), // 2: magistrala.IdentityRes + (*IssueReq)(nil), // 3: magistrala.IssueReq + (*RefreshReq)(nil), // 4: magistrala.RefreshReq + (*AuthorizeReq)(nil), // 5: magistrala.AuthorizeReq + (*AuthorizeRes)(nil), // 6: magistrala.AuthorizeRes + (*AddPolicyReq)(nil), // 7: magistrala.AddPolicyReq + (*AddPoliciesReq)(nil), // 8: magistrala.AddPoliciesReq + (*AddPolicyRes)(nil), // 9: magistrala.AddPolicyRes + (*AddPoliciesRes)(nil), // 10: magistrala.AddPoliciesRes + (*DeletePolicyFilterReq)(nil), // 11: magistrala.DeletePolicyFilterReq + (*DeletePolicyFilterRes)(nil), // 12: magistrala.DeletePolicyFilterRes + (*DeletePoliciesReq)(nil), // 13: magistrala.DeletePoliciesReq + (*DeletePolicyReq)(nil), // 14: magistrala.DeletePolicyReq + (*DeletePoliciesRes)(nil), // 15: magistrala.DeletePoliciesRes + (*ListObjectsReq)(nil), // 16: magistrala.ListObjectsReq + (*ListObjectsRes)(nil), // 17: magistrala.ListObjectsRes + (*CountObjectsReq)(nil), // 18: magistrala.CountObjectsReq + (*CountObjectsRes)(nil), // 19: magistrala.CountObjectsRes + (*ListSubjectsReq)(nil), // 20: magistrala.ListSubjectsReq + (*ListSubjectsRes)(nil), // 21: magistrala.ListSubjectsRes + (*CountSubjectsReq)(nil), // 22: magistrala.CountSubjectsReq + (*CountSubjectsRes)(nil), // 23: magistrala.CountSubjectsRes + (*ListPermissionsReq)(nil), // 24: magistrala.ListPermissionsReq + (*ListPermissionsRes)(nil), // 25: magistrala.ListPermissionsRes } var file_auth_proto_depIdxs = []int32{ 7, // 0: magistrala.AddPoliciesReq.addPoliciesReq:type_name -> magistrala.AddPolicyReq - 11, // 1: magistrala.DeletePoliciesReq.deletePoliciesReq:type_name -> magistrala.DeletePolicyReq + 14, // 1: magistrala.DeletePoliciesReq.deletePoliciesReq:type_name -> magistrala.DeletePolicyReq 5, // 2: magistrala.AuthzService.Authorize:input_type -> magistrala.AuthorizeReq 3, // 3: magistrala.AuthService.Issue:input_type -> magistrala.IssueReq 4, // 4: magistrala.AuthService.Refresh:input_type -> magistrala.RefreshReq @@ -2229,15 +2372,15 @@ var file_auth_proto_depIdxs = []int32{ 5, // 6: magistrala.AuthService.Authorize:input_type -> magistrala.AuthorizeReq 7, // 7: magistrala.AuthService.AddPolicy:input_type -> magistrala.AddPolicyReq 8, // 8: magistrala.AuthService.AddPolicies:input_type -> magistrala.AddPoliciesReq - 11, // 9: magistrala.AuthService.DeletePolicy:input_type -> magistrala.DeletePolicyReq - 12, // 10: magistrala.AuthService.DeletePolicies:input_type -> magistrala.DeletePoliciesReq - 15, // 11: magistrala.AuthService.ListObjects:input_type -> magistrala.ListObjectsReq - 15, // 12: magistrala.AuthService.ListAllObjects:input_type -> magistrala.ListObjectsReq - 17, // 13: magistrala.AuthService.CountObjects:input_type -> magistrala.CountObjectsReq - 19, // 14: magistrala.AuthService.ListSubjects:input_type -> magistrala.ListSubjectsReq - 19, // 15: magistrala.AuthService.ListAllSubjects:input_type -> magistrala.ListSubjectsReq - 21, // 16: magistrala.AuthService.CountSubjects:input_type -> magistrala.CountSubjectsReq - 23, // 17: magistrala.AuthService.ListPermissions:input_type -> magistrala.ListPermissionsReq + 11, // 9: magistrala.AuthService.DeletePolicyFilter:input_type -> magistrala.DeletePolicyFilterReq + 13, // 10: magistrala.AuthService.DeletePolicies:input_type -> magistrala.DeletePoliciesReq + 16, // 11: magistrala.AuthService.ListObjects:input_type -> magistrala.ListObjectsReq + 16, // 12: magistrala.AuthService.ListAllObjects:input_type -> magistrala.ListObjectsReq + 18, // 13: magistrala.AuthService.CountObjects:input_type -> magistrala.CountObjectsReq + 20, // 14: magistrala.AuthService.ListSubjects:input_type -> magistrala.ListSubjectsReq + 20, // 15: magistrala.AuthService.ListAllSubjects:input_type -> magistrala.ListSubjectsReq + 22, // 16: magistrala.AuthService.CountSubjects:input_type -> magistrala.CountSubjectsReq + 24, // 17: magistrala.AuthService.ListPermissions:input_type -> magistrala.ListPermissionsReq 6, // 18: magistrala.AuthzService.Authorize:output_type -> magistrala.AuthorizeRes 0, // 19: magistrala.AuthService.Issue:output_type -> magistrala.Token 0, // 20: magistrala.AuthService.Refresh:output_type -> magistrala.Token @@ -2245,15 +2388,15 @@ var file_auth_proto_depIdxs = []int32{ 6, // 22: magistrala.AuthService.Authorize:output_type -> magistrala.AuthorizeRes 9, // 23: magistrala.AuthService.AddPolicy:output_type -> magistrala.AddPolicyRes 10, // 24: magistrala.AuthService.AddPolicies:output_type -> magistrala.AddPoliciesRes - 13, // 25: magistrala.AuthService.DeletePolicy:output_type -> magistrala.DeletePolicyRes - 14, // 26: magistrala.AuthService.DeletePolicies:output_type -> magistrala.DeletePoliciesRes - 16, // 27: magistrala.AuthService.ListObjects:output_type -> magistrala.ListObjectsRes - 16, // 28: magistrala.AuthService.ListAllObjects:output_type -> magistrala.ListObjectsRes - 18, // 29: magistrala.AuthService.CountObjects:output_type -> magistrala.CountObjectsRes - 20, // 30: magistrala.AuthService.ListSubjects:output_type -> magistrala.ListSubjectsRes - 20, // 31: magistrala.AuthService.ListAllSubjects:output_type -> magistrala.ListSubjectsRes - 22, // 32: magistrala.AuthService.CountSubjects:output_type -> magistrala.CountSubjectsRes - 24, // 33: magistrala.AuthService.ListPermissions:output_type -> magistrala.ListPermissionsRes + 12, // 25: magistrala.AuthService.DeletePolicyFilter:output_type -> magistrala.DeletePolicyFilterRes + 15, // 26: magistrala.AuthService.DeletePolicies:output_type -> magistrala.DeletePoliciesRes + 17, // 27: magistrala.AuthService.ListObjects:output_type -> magistrala.ListObjectsRes + 17, // 28: magistrala.AuthService.ListAllObjects:output_type -> magistrala.ListObjectsRes + 19, // 29: magistrala.AuthService.CountObjects:output_type -> magistrala.CountObjectsRes + 21, // 30: magistrala.AuthService.ListSubjects:output_type -> magistrala.ListSubjectsRes + 21, // 31: magistrala.AuthService.ListAllSubjects:output_type -> magistrala.ListSubjectsRes + 23, // 32: magistrala.AuthService.CountSubjects:output_type -> magistrala.CountSubjectsRes + 25, // 33: magistrala.AuthService.ListPermissions:output_type -> magistrala.ListPermissionsRes 18, // [18:34] is the sub-list for method output_type 2, // [2:18] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name @@ -2400,7 +2543,7 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeletePolicyReq); i { + switch v := v.(*DeletePolicyFilterReq); i { case 0: return &v.state case 1: @@ -2412,7 +2555,7 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeletePoliciesReq); i { + switch v := v.(*DeletePolicyFilterRes); i { case 0: return &v.state case 1: @@ -2424,7 +2567,7 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeletePolicyRes); i { + switch v := v.(*DeletePoliciesReq); i { case 0: return &v.state case 1: @@ -2436,7 +2579,7 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeletePoliciesRes); i { + switch v := v.(*DeletePolicyReq); i { case 0: return &v.state case 1: @@ -2448,7 +2591,7 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListObjectsReq); i { + switch v := v.(*DeletePoliciesRes); i { case 0: return &v.state case 1: @@ -2460,7 +2603,7 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListObjectsRes); i { + switch v := v.(*ListObjectsReq); i { case 0: return &v.state case 1: @@ -2472,7 +2615,7 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CountObjectsReq); i { + switch v := v.(*ListObjectsRes); i { case 0: return &v.state case 1: @@ -2484,7 +2627,7 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CountObjectsRes); i { + switch v := v.(*CountObjectsReq); i { case 0: return &v.state case 1: @@ -2496,7 +2639,7 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListSubjectsReq); i { + switch v := v.(*CountObjectsRes); i { case 0: return &v.state case 1: @@ -2508,7 +2651,7 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListSubjectsRes); i { + switch v := v.(*ListSubjectsReq); i { case 0: return &v.state case 1: @@ -2520,7 +2663,7 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CountSubjectsReq); i { + switch v := v.(*ListSubjectsRes); i { case 0: return &v.state case 1: @@ -2532,7 +2675,7 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CountSubjectsRes); i { + switch v := v.(*CountSubjectsReq); i { case 0: return &v.state case 1: @@ -2544,7 +2687,7 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListPermissionsReq); i { + switch v := v.(*CountSubjectsRes); i { case 0: return &v.state case 1: @@ -2556,6 +2699,18 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListPermissionsReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_auth_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListPermissionsRes); i { case 0: return &v.state @@ -2577,7 +2732,7 @@ func file_auth_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_auth_proto_rawDesc, NumEnums: 0, - NumMessages: 25, + NumMessages: 26, NumExtensions: 0, NumServices: 2, }, diff --git a/auth.proto b/auth.proto index 23dea9085b..9fd2d5bda2 100644 --- a/auth.proto +++ b/auth.proto @@ -23,7 +23,7 @@ service AuthService { rpc Authorize(AuthorizeReq) returns (AuthorizeRes) {} rpc AddPolicy(AddPolicyReq) returns (AddPolicyRes) {} rpc AddPolicies(AddPoliciesReq) returns (AddPoliciesRes) {} - rpc DeletePolicy(DeletePolicyReq) returns (DeletePolicyRes) {} + rpc DeletePolicyFilter(DeletePolicyFilterReq) returns (DeletePolicyFilterRes) {} rpc DeletePolicies(DeletePoliciesReq) returns (DeletePoliciesRes) {} rpc ListObjects(ListObjectsReq) returns (ListObjectsRes) {} rpc ListAllObjects(ListObjectsReq) returns (ListObjectsRes) {} @@ -102,7 +102,7 @@ message AddPolicyRes { bool added = 1; } message AddPoliciesRes { bool added = 1; } -message DeletePolicyReq { +message DeletePolicyFilterReq { string domain = 1; string subject_type = 2; string subject_relation = 3; @@ -115,11 +115,24 @@ message DeletePolicyReq { string object_type = 10; } +message DeletePolicyFilterRes { bool deleted = 1; } + message DeletePoliciesReq { repeated DeletePolicyReq deletePoliciesReq = 1; } -message DeletePolicyRes { bool deleted = 1; } +message DeletePolicyReq { + string domain = 1; + string subject_type = 2; + string subject_relation = 3; + string subject_kind = 4; + string subject = 5; + string relation = 6; + string permission = 7; + string object = 8; + string object_kind = 9; + string object_type = 10; +} message DeletePoliciesRes { bool deleted = 1; } diff --git a/auth/api/grpc/client.go b/auth/api/grpc/client.go index 83c0f789a5..7945ddef61 100644 --- a/auth/api/grpc/client.go +++ b/auth/api/grpc/client.go @@ -24,22 +24,22 @@ const svcName = "magistrala.AuthService" var _ magistrala.AuthServiceClient = (*grpcClient)(nil) type grpcClient struct { - issue endpoint.Endpoint - refresh endpoint.Endpoint - identify endpoint.Endpoint - authorize endpoint.Endpoint - addPolicy endpoint.Endpoint - addPolicies endpoint.Endpoint - deletePolicy endpoint.Endpoint - deletePolicies endpoint.Endpoint - listObjects endpoint.Endpoint - listAllObjects endpoint.Endpoint - countObjects endpoint.Endpoint - listSubjects endpoint.Endpoint - listAllSubjects endpoint.Endpoint - countSubjects endpoint.Endpoint - listPermissions endpoint.Endpoint - timeout time.Duration + issue endpoint.Endpoint + refresh endpoint.Endpoint + identify endpoint.Endpoint + authorize endpoint.Endpoint + addPolicy endpoint.Endpoint + addPolicies endpoint.Endpoint + deletePolicyFilter endpoint.Endpoint + deletePolicies endpoint.Endpoint + listObjects endpoint.Endpoint + listAllObjects endpoint.Endpoint + countObjects endpoint.Endpoint + listSubjects endpoint.Endpoint + listAllSubjects endpoint.Endpoint + countSubjects endpoint.Endpoint + listPermissions endpoint.Endpoint + timeout time.Duration } // NewClient returns new gRPC client instance. @@ -93,13 +93,13 @@ func NewClient(conn *grpc.ClientConn, timeout time.Duration) magistrala.AuthServ decodeAddPoliciesResponse, magistrala.AddPoliciesRes{}, ).Endpoint(), - deletePolicy: kitgrpc.NewClient( + deletePolicyFilter: kitgrpc.NewClient( conn, svcName, - "DeletePolicy", - encodeDeletePolicyRequest, - decodeDeletePolicyResponse, - magistrala.DeletePolicyRes{}, + "DeletePolicyFilter", + encodeDeletePolicyFilterRequest, + decodeDeletePolicyFilterResponse, + magistrala.DeletePolicyFilterRes{}, ).Endpoint(), deletePolicies: kitgrpc.NewClient( conn, @@ -379,11 +379,11 @@ func encodeAddPoliciesRequest(_ context.Context, grpcReq interface{}) (interface return &magistrala.AddPoliciesReq{AddPoliciesReq: addPolicies}, nil } -func (client grpcClient) DeletePolicy(ctx context.Context, in *magistrala.DeletePolicyReq, opts ...grpc.CallOption) (*magistrala.DeletePolicyRes, error) { +func (client grpcClient) DeletePolicyFilter(ctx context.Context, in *magistrala.DeletePolicyFilterReq, opts ...grpc.CallOption) (*magistrala.DeletePolicyFilterRes, error) { ctx, cancel := context.WithTimeout(ctx, client.timeout) defer cancel() - res, err := client.deletePolicy(ctx, policyReq{ + res, err := client.deletePolicyFilter(ctx, policyReq{ Domain: in.GetDomain(), SubjectType: in.GetSubjectType(), SubjectKind: in.GetSubjectKind(), @@ -395,21 +395,21 @@ func (client grpcClient) DeletePolicy(ctx context.Context, in *magistrala.Delete Object: in.GetObject(), }) if err != nil { - return &magistrala.DeletePolicyRes{}, decodeError(err) + return &magistrala.DeletePolicyFilterRes{}, decodeError(err) } - dpr := res.(deletePolicyRes) - return &magistrala.DeletePolicyRes{Deleted: dpr.deleted}, nil + dpr := res.(deletePolicyFilterRes) + return &magistrala.DeletePolicyFilterRes{Deleted: dpr.deleted}, nil } -func decodeDeletePolicyResponse(_ context.Context, grpcRes interface{}) (interface{}, error) { - res := grpcRes.(*magistrala.DeletePolicyRes) - return deletePolicyRes{deleted: res.GetDeleted()}, nil +func decodeDeletePolicyFilterResponse(_ context.Context, grpcRes interface{}) (interface{}, error) { + res := grpcRes.(*magistrala.DeletePolicyFilterRes) + return deletePolicyFilterRes{deleted: res.GetDeleted()}, nil } -func encodeDeletePolicyRequest(_ context.Context, grpcReq interface{}) (interface{}, error) { +func encodeDeletePolicyFilterRequest(_ context.Context, grpcReq interface{}) (interface{}, error) { req := grpcReq.(policyReq) - return &magistrala.DeletePolicyReq{ + return &magistrala.DeletePolicyFilterReq{ Domain: req.Domain, SubjectType: req.SubjectType, SubjectKind: req.SubjectKind, diff --git a/auth/api/grpc/endpoint.go b/auth/api/grpc/endpoint.go index c691ea732e..6aa356a215 100644 --- a/auth/api/grpc/endpoint.go +++ b/auth/api/grpc/endpoint.go @@ -151,14 +151,14 @@ func addPoliciesEndpoint(svc auth.Service) endpoint.Endpoint { } } -func deletePolicyEndpoint(svc auth.Service) endpoint.Endpoint { +func deletePolicyFilterEndpoint(svc auth.Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (interface{}, error) { req := request.(policyReq) if err := req.validate(); err != nil { - return deletePolicyRes{}, err + return deletePolicyFilterRes{}, err } - err := svc.DeletePolicy(ctx, auth.PolicyReq{ + err := svc.DeletePolicyFilter(ctx, auth.PolicyReq{ Domain: req.Domain, SubjectKind: req.SubjectKind, SubjectType: req.SubjectType, @@ -170,9 +170,9 @@ func deletePolicyEndpoint(svc auth.Service) endpoint.Endpoint { Object: req.Object, }) if err != nil { - return deletePolicyRes{}, err + return deletePolicyFilterRes{}, err } - return deletePolicyRes{deleted: true}, nil + return deletePolicyFilterRes{deleted: true}, nil } } diff --git a/auth/api/grpc/endpoint_test.go b/auth/api/grpc/endpoint_test.go index 17e881e7cb..cabb519717 100644 --- a/auth/api/grpc/endpoint_test.go +++ b/auth/api/grpc/endpoint_test.go @@ -124,10 +124,10 @@ func TestIssue(t *testing.T) { } for _, tc := range cases { - repoCall := svc.On("Issue", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(tc.issueResponse, tc.err) + svcCall := svc.On("Issue", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(tc.issueResponse, tc.err) _, err := client.Issue(context.Background(), &magistrala.IssueReq{UserId: tc.userId, DomainId: &tc.domainID, Type: uint32(tc.kind)}) assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err)) - repoCall.Unset() + svcCall.Unset() } } @@ -170,10 +170,10 @@ func TestRefresh(t *testing.T) { } for _, tc := range cases { - repoCall := svc.On("Issue", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(tc.issueResponse, tc.err) + svcCall := svc.On("Issue", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(tc.issueResponse, tc.err) _, err := client.Refresh(context.Background(), &magistrala.RefreshReq{DomainId: &tc.domainID, RefreshToken: tc.token}) assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err)) - repoCall.Unset() + svcCall.Unset() } } @@ -211,13 +211,13 @@ func TestIdentify(t *testing.T) { } for _, tc := range cases { - repoCall := svc.On("Identify", mock.Anything, mock.Anything, mock.Anything).Return(auth.Key{Subject: id, User: email, Domain: domainID}, tc.svcErr) + svcCall := svc.On("Identify", mock.Anything, mock.Anything, mock.Anything).Return(auth.Key{Subject: id, User: email, Domain: domainID}, tc.svcErr) idt, err := client.Identify(context.Background(), &magistrala.IdentityReq{Token: tc.token}) if idt != nil { assert.Equal(t, tc.idt, idt, fmt.Sprintf("%s: expected %v got %v", tc.desc, tc.idt, idt)) } assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err)) - repoCall.Unset() + svcCall.Unset() } } @@ -333,13 +333,13 @@ func TestAuthorize(t *testing.T) { }, } for _, tc := range cases { - repocall := svc.On("Authorize", mock.Anything, mock.Anything).Return(tc.err) + svccall := svc.On("Authorize", mock.Anything, mock.Anything).Return(tc.err) ar, err := client.Authorize(context.Background(), tc.authRequest) if ar != nil { assert.Equal(t, tc.authResponse, ar, fmt.Sprintf("%s: expected %v got %v", tc.desc, tc.authResponse, ar)) } assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err)) - repocall.Unset() + svccall.Unset() } } @@ -387,13 +387,13 @@ func TestAddPolicy(t *testing.T) { }, } for _, tc := range cases { - repoCall := svc.On("AddPolicy", mock.Anything, mock.Anything).Return(tc.err) + svcCall := svc.On("AddPolicy", mock.Anything, mock.Anything).Return(tc.err) apr, err := client.AddPolicy(context.Background(), tc.addPolicyReq) if apr != nil { assert.Equal(t, tc.addPolicyRes, apr, fmt.Sprintf("%s: expected %v got %v", tc.desc, tc.addPolicyRes, apr)) } assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err)) - repoCall.Unset() + svcCall.Unset() } } @@ -449,17 +449,17 @@ func TestAddPolicies(t *testing.T) { }, } for _, tc := range cases { - repoCall := svc.On("AddPolicies", mock.Anything, mock.Anything).Return(tc.err) + svcCall := svc.On("AddPolicies", mock.Anything, mock.Anything).Return(tc.err) apr, err := client.AddPolicies(context.Background(), tc.pr) if apr != nil { assert.Equal(t, tc.ar, apr, fmt.Sprintf("%s: expected %v got %v", tc.desc, tc.ar, apr)) } assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err)) - repoCall.Unset() + svcCall.Unset() } } -func TestDeletePolicy(t *testing.T) { +func TestDeletePolicyFilter(t *testing.T) { conn, err := grpc.NewClient(authAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) assert.Nil(t, err, fmt.Sprintf("Unexpected error creating client connection %s", err)) client := grpcapi.NewClient(conn, time.Second) @@ -468,16 +468,16 @@ func TestDeletePolicy(t *testing.T) { thingID := "thing" cases := []struct { - desc string - token string - deletePolicyReq *magistrala.DeletePolicyReq - deletePolicyRes *magistrala.DeletePolicyRes - err error + desc string + token string + deletePolicyFilterReq *magistrala.DeletePolicyFilterReq + deletePolicyFilterRes *magistrala.DeletePolicyFilterRes + err error }{ { desc: "delete valid policy", token: validToken, - deletePolicyReq: &magistrala.DeletePolicyReq{ + deletePolicyFilterReq: &magistrala.DeletePolicyFilterReq{ Subject: id, SubjectType: usersType, Object: thingID, @@ -485,13 +485,13 @@ func TestDeletePolicy(t *testing.T) { Relation: readRelation, Permission: readRelation, }, - deletePolicyRes: &magistrala.DeletePolicyRes{Deleted: true}, - err: nil, + deletePolicyFilterRes: &magistrala.DeletePolicyFilterRes{Deleted: true}, + err: nil, }, { desc: "delete invalid policy with invalid token", token: inValidToken, - deletePolicyReq: &magistrala.DeletePolicyReq{ + deletePolicyFilterReq: &magistrala.DeletePolicyFilterReq{ Subject: id, SubjectType: usersType, Object: thingID, @@ -499,16 +499,16 @@ func TestDeletePolicy(t *testing.T) { Relation: readRelation, Permission: readRelation, }, - deletePolicyRes: &magistrala.DeletePolicyRes{Deleted: false}, - err: svcerr.ErrAuthorization, + deletePolicyFilterRes: &magistrala.DeletePolicyFilterRes{Deleted: false}, + err: svcerr.ErrAuthorization, }, } for _, tc := range cases { - repoCall := svc.On("DeletePolicy", mock.Anything, mock.Anything).Return(tc.err) - dpr, err := client.DeletePolicy(context.Background(), tc.deletePolicyReq) - assert.Equal(t, tc.deletePolicyRes.GetDeleted(), dpr.GetDeleted(), fmt.Sprintf("%s: expected %v got %v", tc.desc, tc.deletePolicyRes.GetDeleted(), dpr.GetDeleted())) + svcCall := svc.On("DeletePolicyFilter", mock.Anything, mock.Anything).Return(tc.err) + dpr, err := client.DeletePolicyFilter(context.Background(), tc.deletePolicyFilterReq) + assert.Equal(t, tc.deletePolicyFilterRes.GetDeleted(), dpr.GetDeleted(), fmt.Sprintf("%s: expected %v got %v", tc.desc, tc.deletePolicyFilterRes.GetDeleted(), dpr.GetDeleted())) assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err)) - repoCall.Unset() + svcCall.Unset() } } @@ -565,13 +565,13 @@ func TestDeletePolicies(t *testing.T) { }, } for _, tc := range cases { - repoCall := svc.On("DeletePolicies", mock.Anything, mock.Anything).Return(tc.err) + svcCall := svc.On("DeletePolicies", mock.Anything, mock.Anything).Return(tc.err) apr, err := client.DeletePolicies(context.Background(), tc.deletePoliciesReq) if apr != nil { assert.Equal(t, tc.deletePoliciesRes, apr, fmt.Sprintf("%s: expected %v got %v", tc.desc, tc.deletePoliciesRes, apr)) } assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err)) - repoCall.Unset() + svcCall.Unset() } } @@ -615,13 +615,13 @@ func TestListObjects(t *testing.T) { }, } for _, tc := range cases { - repoCall := svc.On("ListObjects", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(auth.PolicyPage{Policies: tc.listObjectsRes.Policies}, tc.err) + svcCall := svc.On("ListObjects", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(auth.PolicyPage{Policies: tc.listObjectsRes.Policies}, tc.err) apr, err := client.ListObjects(context.Background(), tc.listObjectsReq) if apr != nil { assert.Equal(t, tc.listObjectsRes, apr, fmt.Sprintf("%s: expected %v got %v", tc.desc, tc.listObjectsRes, apr)) } assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err)) - repoCall.Unset() + svcCall.Unset() } } @@ -665,13 +665,13 @@ func TestListAllObjects(t *testing.T) { }, } for _, tc := range cases { - repoCall := svc.On("ListAllObjects", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(auth.PolicyPage{Policies: tc.listAllObjectsRes.Policies}, tc.err) + svcCall := svc.On("ListAllObjects", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(auth.PolicyPage{Policies: tc.listAllObjectsRes.Policies}, tc.err) apr, err := client.ListAllObjects(context.Background(), tc.listAllObjectsReq) if apr != nil { assert.Equal(t, tc.listAllObjectsRes, apr, fmt.Sprintf("%s: expected %v got %v", tc.desc, tc.listAllObjectsRes, apr)) } assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err)) - repoCall.Unset() + svcCall.Unset() } } @@ -715,13 +715,13 @@ func TestCountObects(t *testing.T) { }, } for _, tc := range cases { - repoCall := svc.On("CountObjects", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(tc.countObjectsRes.Count, tc.err) + svcCall := svc.On("CountObjects", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(tc.countObjectsRes.Count, tc.err) apr, err := client.CountObjects(context.Background(), tc.countObjectsReq) if apr != nil { assert.Equal(t, tc.countObjectsRes, apr, fmt.Sprintf("%s: expected %v got %v", tc.desc, tc.countObjectsRes, apr)) } assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err)) - repoCall.Unset() + svcCall.Unset() } } @@ -765,13 +765,13 @@ func TestListSubjects(t *testing.T) { }, } for _, tc := range cases { - repoCall := svc.On("ListSubjects", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(auth.PolicyPage{Policies: tc.listSubjectsRes.Policies}, tc.err) + svcCall := svc.On("ListSubjects", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(auth.PolicyPage{Policies: tc.listSubjectsRes.Policies}, tc.err) apr, err := client.ListSubjects(context.Background(), tc.listSubjectsReq) if apr != nil { assert.Equal(t, tc.listSubjectsRes, apr, fmt.Sprintf("%s: expected %v got %v", tc.desc, tc.listSubjectsRes, apr)) } assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err)) - repoCall.Unset() + svcCall.Unset() } } @@ -815,13 +815,13 @@ func TestListAllSubjects(t *testing.T) { }, } for _, tc := range cases { - repoCall := svc.On("ListAllSubjects", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(auth.PolicyPage{Policies: tc.listSubjectsRes.Policies}, tc.err) + svcCall := svc.On("ListAllSubjects", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(auth.PolicyPage{Policies: tc.listSubjectsRes.Policies}, tc.err) apr, err := client.ListAllSubjects(context.Background(), tc.listSubjectsReq) if apr != nil { assert.Equal(t, tc.listSubjectsRes, apr, fmt.Sprintf("%s: expected %v got %v", tc.desc, tc.listSubjectsRes, apr)) } assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err)) - repoCall.Unset() + svcCall.Unset() } } @@ -868,7 +868,7 @@ func TestCountSubjects(t *testing.T) { }, } for _, tc := range cases { - repoCall := svc.On("CountSubjects", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(tc.countSubjectsRes.Count, tc.err) + svcCall := svc.On("CountSubjects", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(tc.countSubjectsRes.Count, tc.err) apr, err := client.CountSubjects(context.Background(), tc.countSubjectsReq) if apr != nil { assert.Equal(t, tc.countSubjectsRes, apr, fmt.Sprintf("%s: expected %v got %v", tc.desc, tc.countSubjectsRes, apr)) @@ -876,7 +876,7 @@ func TestCountSubjects(t *testing.T) { e, ok := status.FromError(err) assert.True(t, ok, "gRPC status can't be extracted from the error") assert.Equal(t, tc.code, e.Code(), fmt.Sprintf("%s: expected %s got %s", tc.desc, tc.code, e.Code())) - repoCall.Unset() + svcCall.Unset() } } @@ -1001,12 +1001,12 @@ func TestListPermissions(t *testing.T) { }, } for _, tc := range cases { - repoCall := svc.On("ListPermissions", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(auth.Permissions{"view"}, tc.err) + svcCall := svc.On("ListPermissions", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(auth.Permissions{"view"}, tc.err) apr, err := client.ListPermissions(context.Background(), tc.listPermissionsReq) if apr != nil { assert.Equal(t, tc.listPermissionsRes, apr, fmt.Sprintf("%s: expected %v got %v", tc.desc, tc.listPermissionsRes, apr)) } assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err)) - repoCall.Unset() + svcCall.Unset() } } diff --git a/auth/api/grpc/responses.go b/auth/api/grpc/responses.go index 40122b120e..20ab65f793 100644 --- a/auth/api/grpc/responses.go +++ b/auth/api/grpc/responses.go @@ -27,7 +27,7 @@ type addPoliciesRes struct { added bool } -type deletePolicyRes struct { +type deletePolicyFilterRes struct { deleted bool } diff --git a/auth/api/grpc/server.go b/auth/api/grpc/server.go index fb23f7bf73..a4198cca77 100644 --- a/auth/api/grpc/server.go +++ b/auth/api/grpc/server.go @@ -20,21 +20,21 @@ var _ magistrala.AuthServiceServer = (*grpcServer)(nil) type grpcServer struct { magistrala.UnimplementedAuthServiceServer - issue kitgrpc.Handler - refresh kitgrpc.Handler - identify kitgrpc.Handler - authorize kitgrpc.Handler - addPolicy kitgrpc.Handler - addPolicies kitgrpc.Handler - deletePolicy kitgrpc.Handler - deletePolicies kitgrpc.Handler - listObjects kitgrpc.Handler - listAllObjects kitgrpc.Handler - countObjects kitgrpc.Handler - listSubjects kitgrpc.Handler - listAllSubjects kitgrpc.Handler - countSubjects kitgrpc.Handler - listPermissions kitgrpc.Handler + issue kitgrpc.Handler + refresh kitgrpc.Handler + identify kitgrpc.Handler + authorize kitgrpc.Handler + addPolicy kitgrpc.Handler + addPolicies kitgrpc.Handler + deletePolicyFilter kitgrpc.Handler + deletePolicies kitgrpc.Handler + listObjects kitgrpc.Handler + listAllObjects kitgrpc.Handler + countObjects kitgrpc.Handler + listSubjects kitgrpc.Handler + listAllSubjects kitgrpc.Handler + countSubjects kitgrpc.Handler + listPermissions kitgrpc.Handler } // NewServer returns new AuthServiceServer instance. @@ -70,10 +70,10 @@ func NewServer(svc auth.Service) magistrala.AuthServiceServer { decodeAddPoliciesRequest, encodeAddPoliciesResponse, ), - deletePolicy: kitgrpc.NewServer( - (deletePolicyEndpoint(svc)), - decodeDeletePolicyRequest, - encodeDeletePolicyResponse, + deletePolicyFilter: kitgrpc.NewServer( + (deletePolicyFilterEndpoint(svc)), + decodeDeletePolicyFilterRequest, + encodeDeletePolicyFilterResponse, ), deletePolicies: kitgrpc.NewServer( (deletePoliciesEndpoint(svc)), @@ -166,12 +166,12 @@ func (s *grpcServer) AddPolicies(ctx context.Context, req *magistrala.AddPolicie return res.(*magistrala.AddPoliciesRes), nil } -func (s *grpcServer) DeletePolicy(ctx context.Context, req *magistrala.DeletePolicyReq) (*magistrala.DeletePolicyRes, error) { - _, res, err := s.deletePolicy.ServeGRPC(ctx, req) +func (s *grpcServer) DeletePolicyFilter(ctx context.Context, req *magistrala.DeletePolicyFilterReq) (*magistrala.DeletePolicyFilterRes, error) { + _, res, err := s.deletePolicyFilter.ServeGRPC(ctx, req) if err != nil { return nil, encodeError(err) } - return res.(*magistrala.DeletePolicyRes), nil + return res.(*magistrala.DeletePolicyFilterRes), nil } func (s *grpcServer) DeletePolicies(ctx context.Context, req *magistrala.DeletePoliciesReq) (*magistrala.DeletePoliciesRes, error) { @@ -335,8 +335,8 @@ func encodeAddPoliciesResponse(_ context.Context, grpcRes interface{}) (interfac return &magistrala.AddPoliciesRes{Added: res.added}, nil } -func decodeDeletePolicyRequest(_ context.Context, grpcReq interface{}) (interface{}, error) { - req := grpcReq.(*magistrala.DeletePolicyReq) +func decodeDeletePolicyFilterRequest(_ context.Context, grpcReq interface{}) (interface{}, error) { + req := grpcReq.(*magistrala.DeletePolicyFilterReq) return policyReq{ Domain: req.GetDomain(), SubjectType: req.GetSubjectType(), @@ -350,9 +350,9 @@ func decodeDeletePolicyRequest(_ context.Context, grpcReq interface{}) (interfac }, nil } -func encodeDeletePolicyResponse(_ context.Context, grpcRes interface{}) (interface{}, error) { - res := grpcRes.(deletePolicyRes) - return &magistrala.DeletePolicyRes{Deleted: res.deleted}, nil +func encodeDeletePolicyFilterResponse(_ context.Context, grpcRes interface{}) (interface{}, error) { + res := grpcRes.(deletePolicyFilterRes) + return &magistrala.DeletePolicyFilterRes{Deleted: res.deleted}, nil } func decodeDeletePoliciesRequest(_ context.Context, grpcReq interface{}) (interface{}, error) { diff --git a/auth/api/logging.go b/auth/api/logging.go index 3f2c7537c1..12ffe3ca89 100644 --- a/auth/api/logging.go +++ b/auth/api/logging.go @@ -293,7 +293,7 @@ func (lm *loggingMiddleware) AddPolicies(ctx context.Context, prs []auth.PolicyR return lm.svc.AddPolicies(ctx, prs) } -func (lm *loggingMiddleware) DeletePolicy(ctx context.Context, pr auth.PolicyReq) (err error) { +func (lm *loggingMiddleware) DeletePolicyFilter(ctx context.Context, pr auth.PolicyReq) (err error) { defer func(begin time.Time) { args := []any{ slog.String("duration", time.Since(begin).String()), @@ -307,12 +307,12 @@ func (lm *loggingMiddleware) DeletePolicy(ctx context.Context, pr auth.PolicyReq } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Delete policy failed to complete successfully", args...) + lm.logger.Warn("Delete policy filter failed to complete successfully", args...) return } - lm.logger.Info("Delete policy completed successfully", args...) + lm.logger.Info("Delete policy filter completed successfully", args...) }(time.Now()) - return lm.svc.DeletePolicy(ctx, pr) + return lm.svc.DeletePolicyFilter(ctx, pr) } func (lm *loggingMiddleware) DeletePolicies(ctx context.Context, prs []auth.PolicyReq) (err error) { diff --git a/auth/api/metrics.go b/auth/api/metrics.go index c7e63e2a60..82634196c5 100644 --- a/auth/api/metrics.go +++ b/auth/api/metrics.go @@ -152,12 +152,12 @@ func (ms *metricsMiddleware) AddPolicies(ctx context.Context, prs []auth.PolicyR return ms.svc.AddPolicies(ctx, prs) } -func (ms *metricsMiddleware) DeletePolicy(ctx context.Context, pr auth.PolicyReq) error { +func (ms *metricsMiddleware) DeletePolicyFilter(ctx context.Context, pr auth.PolicyReq) error { defer func(begin time.Time) { - ms.counter.With("method", "delete_policy").Add(1) - ms.latency.With("method", "delete_policy").Observe(time.Since(begin).Seconds()) + ms.counter.With("method", "delete_policy_filter").Add(1) + ms.latency.With("method", "delete_policy_filter").Observe(time.Since(begin).Seconds()) }(time.Now()) - return ms.svc.DeletePolicy(ctx, pr) + return ms.svc.DeletePolicyFilter(ctx, pr) } func (ms *metricsMiddleware) DeletePolicies(ctx context.Context, prs []auth.PolicyReq) error { diff --git a/auth/mocks/agent.go b/auth/mocks/agent.go index 381c617cef..7b9415e908 100644 --- a/auth/mocks/agent.go +++ b/auth/mocks/agent.go @@ -89,12 +89,12 @@ func (_m *PolicyAgent) DeletePolicies(ctx context.Context, pr []auth.PolicyReq) return r0 } -// DeletePolicy provides a mock function with given fields: ctx, pr -func (_m *PolicyAgent) DeletePolicy(ctx context.Context, pr auth.PolicyReq) error { +// DeletePolicyFilter provides a mock function with given fields: ctx, pr +func (_m *PolicyAgent) DeletePolicyFilter(ctx context.Context, pr auth.PolicyReq) error { ret := _m.Called(ctx, pr) if len(ret) == 0 { - panic("no return value specified for DeletePolicy") + panic("no return value specified for DeletePolicyFilter") } var r0 error diff --git a/auth/mocks/auth_client.go b/auth/mocks/auth_client.go index 1fe4076b3b..6326855b9a 100644 --- a/auth/mocks/auth_client.go +++ b/auth/mocks/auth_client.go @@ -71,10 +71,10 @@ func (m *AuthClient) AddPolicies(ctx context.Context, in *magistrala.AddPolicies return ret.Get(0).(*magistrala.AddPoliciesRes), ret.Error(1) } -func (m *AuthClient) DeletePolicy(ctx context.Context, in *magistrala.DeletePolicyReq, opts ...grpc.CallOption) (*magistrala.DeletePolicyRes, error) { +func (m *AuthClient) DeletePolicyFilter(ctx context.Context, in *magistrala.DeletePolicyFilterReq, opts ...grpc.CallOption) (*magistrala.DeletePolicyFilterRes, error) { ret := m.Called(ctx, in) - return ret.Get(0).(*magistrala.DeletePolicyRes), ret.Error(1) + return ret.Get(0).(*magistrala.DeletePolicyFilterRes), ret.Error(1) } func (m *AuthClient) DeletePolicies(ctx context.Context, in *magistrala.DeletePoliciesReq, opts ...grpc.CallOption) (*magistrala.DeletePoliciesRes, error) { diff --git a/auth/mocks/authz.go b/auth/mocks/authz.go index fa1028759f..9a4e4bf411 100644 --- a/auth/mocks/authz.go +++ b/auth/mocks/authz.go @@ -145,12 +145,12 @@ func (_m *Authz) DeletePolicies(ctx context.Context, prs []auth.PolicyReq) error return r0 } -// DeletePolicy provides a mock function with given fields: ctx, pr -func (_m *Authz) DeletePolicy(ctx context.Context, pr auth.PolicyReq) error { +// DeletePolicyFilter provides a mock function with given fields: ctx, pr +func (_m *Authz) DeletePolicyFilter(ctx context.Context, pr auth.PolicyReq) error { ret := _m.Called(ctx, pr) if len(ret) == 0 { - panic("no return value specified for DeletePolicy") + panic("no return value specified for DeletePolicyFilter") } var r0 error diff --git a/auth/mocks/service.go b/auth/mocks/service.go index 49f36f208d..4f3401751b 100644 --- a/auth/mocks/service.go +++ b/auth/mocks/service.go @@ -219,12 +219,12 @@ func (_m *Service) DeletePolicies(ctx context.Context, prs []auth.PolicyReq) err return r0 } -// DeletePolicy provides a mock function with given fields: ctx, pr -func (_m *Service) DeletePolicy(ctx context.Context, pr auth.PolicyReq) error { +// DeletePolicyFilter provides a mock function with given fields: ctx, pr +func (_m *Service) DeletePolicyFilter(ctx context.Context, pr auth.PolicyReq) error { ret := _m.Called(ctx, pr) if len(ret) == 0 { - panic("no return value specified for DeletePolicy") + panic("no return value specified for DeletePolicyFilter") } var r0 error diff --git a/auth/policies.go b/auth/policies.go index e3464e508b..245cf3de7a 100644 --- a/auth/policies.go +++ b/auth/policies.go @@ -143,8 +143,8 @@ type Authz interface { // only allowed to use as an admin. AddPolicies(ctx context.Context, prs []PolicyReq) error - // DeletePolicy removes a policy. - DeletePolicy(ctx context.Context, pr PolicyReq) error + // DeletePolicyFilter removes policy for given policy filter request. + DeletePolicyFilter(ctx context.Context, pr PolicyReq) error // DeletePolicies deletes policies for given subjects. This method is // only allowed to use as an admin. @@ -191,10 +191,10 @@ type PolicyAgent interface { // AddPolicies creates a Bulk Policies for the given request AddPolicies(ctx context.Context, prs []PolicyReq) error - // DeletePolicy removes a policy. - DeletePolicy(ctx context.Context, pr PolicyReq) error + // DeletePolicyFilter removes policy for given policy filter request. + DeletePolicyFilter(ctx context.Context, pr PolicyReq) error - // DeletePolicy removes a policy. + // DeletePolicies removes a bulk policies for the given request. DeletePolicies(ctx context.Context, pr []PolicyReq) error // RetrieveObjects diff --git a/auth/service.go b/auth/service.go index b7003eba93..33372afdc4 100644 --- a/auth/service.go +++ b/auth/service.go @@ -305,8 +305,8 @@ func (svc service) AddPolicies(ctx context.Context, prs []PolicyReq) error { return svc.agent.AddPolicies(ctx, prs) } -func (svc service) DeletePolicy(ctx context.Context, pr PolicyReq) error { - return svc.agent.DeletePolicy(ctx, pr) +func (svc service) DeletePolicyFilter(ctx context.Context, pr PolicyReq) error { + return svc.agent.DeletePolicyFilter(ctx, pr) } func (svc service) DeletePolicies(ctx context.Context, prs []PolicyReq) error { diff --git a/auth/service_test.go b/auth/service_test.go index e8ff314a07..b06cf44838 100644 --- a/auth/service_test.go +++ b/auth/service_test.go @@ -1336,8 +1336,8 @@ func TestDeletePolicy(t *testing.T) { } for _, tc := range cases { - repocall := prepo.On("DeletePolicy", mock.Anything, mock.Anything).Return(tc.err) - err := svc.DeletePolicy(context.Background(), tc.pr) + repocall := prepo.On("DeletePolicyFilter", context.Background(), mock.Anything).Return(tc.err) + err := svc.DeletePolicyFilter(context.Background(), tc.pr) assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s expected %s got %s\n", tc.desc, tc.err, err)) repocall.Unset() } @@ -1398,7 +1398,7 @@ func TestDeletePolicies(t *testing.T) { } for _, tc := range cases { - repocall := prepo.On("DeletePolicies", mock.Anything, mock.Anything).Return(tc.err) + repocall := prepo.On("DeletePolicies", context.Background(), mock.Anything).Return(tc.err) err := svc.DeletePolicies(context.Background(), tc.pr) assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s expected %s got %s\n", tc.desc, tc.err, err)) repocall.Unset() @@ -1448,7 +1448,7 @@ func TestListObjects(t *testing.T) { }, } for _, tc := range cases { - repocall2 := prepo.On("RetrieveObjects", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(expectedPolicies, mock.Anything, tc.err) + repocall2 := prepo.On("RetrieveObjects", context.Background(), mock.Anything, mock.Anything, mock.Anything).Return(expectedPolicies, mock.Anything, tc.err) page, err := svc.ListObjects(context.Background(), tc.pr, tc.nextPageToken, tc.limit) assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("listing policies expected to succeed: %s", err)) if err == nil { @@ -1501,7 +1501,7 @@ func TestListAllObjects(t *testing.T) { }, } for _, tc := range cases { - repocall2 := prepo.On("RetrieveAllObjects", mock.Anything, mock.Anything).Return(expectedPolicies, tc.err) + repocall2 := prepo.On("RetrieveAllObjects", context.Background(), mock.Anything).Return(expectedPolicies, tc.err) page, err := svc.ListAllObjects(context.Background(), tc.pr) assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("listing policies expected to succeed: %s", err)) if err == nil { @@ -1516,7 +1516,7 @@ func TestCountObjects(t *testing.T) { pageLen := uint64(15) - repocall2 := prepo.On("RetrieveAllObjectsCount", mock.Anything, mock.Anything, mock.Anything).Return(pageLen, nil) + repocall2 := prepo.On("RetrieveAllObjectsCount", context.Background(), mock.Anything, mock.Anything).Return(pageLen, nil) count, err := svc.CountObjects(context.Background(), auth.PolicyReq{Subject: id, SubjectType: auth.UserType, ObjectType: auth.ThingType, Permission: auth.ViewPermission}) assert.Nil(t, err, fmt.Sprintf("counting policies expected to succeed: %s", err)) assert.Equal(t, pageLen, count, fmt.Sprintf("unexpected listing page size, expected %d, got %d: %v", pageLen, count, err)) @@ -1566,13 +1566,13 @@ func TestListSubjects(t *testing.T) { }, } for _, tc := range cases { - repocall2 := prepo.On("RetrieveSubjects", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(expectedPolicies, mock.Anything, tc.err) + repocall := prepo.On("RetrieveSubjects", context.Background(), mock.Anything, mock.Anything, mock.Anything).Return(expectedPolicies, mock.Anything, tc.err) page, err := svc.ListSubjects(context.Background(), tc.pr, tc.nextPageToken, tc.limit) assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("listing policies expected to succeed: %s", err)) if err == nil { assert.Equal(t, pageLen, len(page.Policies), fmt.Sprintf("unexpected listing page size, expected %d, got %d: %v", pageLen, len(page.Policies), err)) } - repocall2.Unset() + repocall.Unset() } } @@ -1619,13 +1619,13 @@ func TestListAllSubjects(t *testing.T) { }, } for _, tc := range cases { - repocall2 := prepo.On("RetrieveAllSubjects", mock.Anything, mock.Anything).Return(expectedPolicies, tc.err) + repocall := prepo.On("RetrieveAllSubjects", context.Background(), mock.Anything).Return(expectedPolicies, tc.err) page, err := svc.ListAllSubjects(context.Background(), tc.pr) assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("listing policies expected to succeed: %s", err)) if err == nil { assert.Equal(t, pageLen, len(page.Policies), fmt.Sprintf("unexpected listing page size, expected %d, got %d: %v", pageLen, len(page.Policies), err)) } - repocall2.Unset() + repocall.Unset() } } @@ -1633,11 +1633,11 @@ func TestCountSubjects(t *testing.T) { svc, _ := newService() pageLen := uint64(15) - repocall2 := prepo.On("RetrieveAllSubjectsCount", mock.Anything, mock.Anything, mock.Anything).Return(pageLen, nil) + repocall := prepo.On("RetrieveAllSubjectsCount", mock.Anything, mock.Anything, mock.Anything).Return(pageLen, nil) count, err := svc.CountSubjects(context.Background(), auth.PolicyReq{Object: id, ObjectType: auth.ThingType, Permission: auth.ViewPermission}) assert.Nil(t, err, fmt.Sprintf("counting policies expected to succeed: %s", err)) assert.Equal(t, pageLen, count, fmt.Sprintf("unexpected listing page size, expected %d, got %d: %v", pageLen, count, err)) - repocall2.Unset() + repocall.Unset() } func TestListPermissions(t *testing.T) { @@ -1653,10 +1653,10 @@ func TestListPermissions(t *testing.T) { } filterPermisions := []string{auth.ViewPermission, auth.AdminPermission} - repoCall1 := prepo.On("RetrievePermissions", mock.Anything, pr, filterPermisions).Return(auth.Permissions{}, nil) + repoCall := prepo.On("RetrievePermissions", context.Background(), pr, filterPermisions).Return(auth.Permissions{}, nil) _, err := svc.ListPermissions(context.Background(), pr, filterPermisions) assert.Nil(t, err, fmt.Sprintf("listing policies expected to succeed: %s", err)) - repoCall1.Unset() + repoCall.Unset() } func TestSwitchToPermission(t *testing.T) { diff --git a/auth/spicedb/policies.go b/auth/spicedb/policies.go index 3ff9383250..751e8ed143 100644 --- a/auth/spicedb/policies.go +++ b/auth/spicedb/policies.go @@ -153,7 +153,7 @@ func (pa *policyAgent) DeletePolicies(ctx context.Context, prs []auth.PolicyReq) return nil } -func (pa *policyAgent) DeletePolicy(ctx context.Context, pr auth.PolicyReq) error { +func (pa *policyAgent) DeletePolicyFilter(ctx context.Context, pr auth.PolicyReq) error { req := &v1.DeleteRelationshipsRequest{ RelationshipFilter: &v1.RelationshipFilter{ ResourceType: pr.ObjectType, diff --git a/auth/tracing/tracing.go b/auth/tracing/tracing.go index e95c33a710..06dc56feb6 100644 --- a/auth/tracing/tracing.go +++ b/auth/tracing/tracing.go @@ -96,7 +96,7 @@ func (tm *tracingMiddleware) AddPolicies(ctx context.Context, prs []auth.PolicyR return tm.svc.AddPolicies(ctx, prs) } -func (tm *tracingMiddleware) DeletePolicy(ctx context.Context, pr auth.PolicyReq) error { +func (tm *tracingMiddleware) DeletePolicyFilter(ctx context.Context, pr auth.PolicyReq) error { ctx, span := tm.tracer.Start(ctx, "delete_policy", trace.WithAttributes( attribute.String("subject", pr.Subject), attribute.String("subject_type", pr.SubjectType), @@ -108,7 +108,7 @@ func (tm *tracingMiddleware) DeletePolicy(ctx context.Context, pr auth.PolicyReq )) defer span.End() - return tm.svc.DeletePolicy(ctx, pr) + return tm.svc.DeletePolicyFilter(ctx, pr) } func (tm *tracingMiddleware) DeletePolicies(ctx context.Context, prs []auth.PolicyReq) error { diff --git a/auth_grpc.pb.go b/auth_grpc.pb.go index c60c51381c..7a08603782 100644 --- a/auth_grpc.pb.go +++ b/auth_grpc.pb.go @@ -116,21 +116,21 @@ var AuthzService_ServiceDesc = grpc.ServiceDesc{ } const ( - AuthService_Issue_FullMethodName = "/magistrala.AuthService/Issue" - AuthService_Refresh_FullMethodName = "/magistrala.AuthService/Refresh" - AuthService_Identify_FullMethodName = "/magistrala.AuthService/Identify" - AuthService_Authorize_FullMethodName = "/magistrala.AuthService/Authorize" - AuthService_AddPolicy_FullMethodName = "/magistrala.AuthService/AddPolicy" - AuthService_AddPolicies_FullMethodName = "/magistrala.AuthService/AddPolicies" - AuthService_DeletePolicy_FullMethodName = "/magistrala.AuthService/DeletePolicy" - AuthService_DeletePolicies_FullMethodName = "/magistrala.AuthService/DeletePolicies" - AuthService_ListObjects_FullMethodName = "/magistrala.AuthService/ListObjects" - AuthService_ListAllObjects_FullMethodName = "/magistrala.AuthService/ListAllObjects" - AuthService_CountObjects_FullMethodName = "/magistrala.AuthService/CountObjects" - AuthService_ListSubjects_FullMethodName = "/magistrala.AuthService/ListSubjects" - AuthService_ListAllSubjects_FullMethodName = "/magistrala.AuthService/ListAllSubjects" - AuthService_CountSubjects_FullMethodName = "/magistrala.AuthService/CountSubjects" - AuthService_ListPermissions_FullMethodName = "/magistrala.AuthService/ListPermissions" + AuthService_Issue_FullMethodName = "/magistrala.AuthService/Issue" + AuthService_Refresh_FullMethodName = "/magistrala.AuthService/Refresh" + AuthService_Identify_FullMethodName = "/magistrala.AuthService/Identify" + AuthService_Authorize_FullMethodName = "/magistrala.AuthService/Authorize" + AuthService_AddPolicy_FullMethodName = "/magistrala.AuthService/AddPolicy" + AuthService_AddPolicies_FullMethodName = "/magistrala.AuthService/AddPolicies" + AuthService_DeletePolicyFilter_FullMethodName = "/magistrala.AuthService/DeletePolicyFilter" + AuthService_DeletePolicies_FullMethodName = "/magistrala.AuthService/DeletePolicies" + AuthService_ListObjects_FullMethodName = "/magistrala.AuthService/ListObjects" + AuthService_ListAllObjects_FullMethodName = "/magistrala.AuthService/ListAllObjects" + AuthService_CountObjects_FullMethodName = "/magistrala.AuthService/CountObjects" + AuthService_ListSubjects_FullMethodName = "/magistrala.AuthService/ListSubjects" + AuthService_ListAllSubjects_FullMethodName = "/magistrala.AuthService/ListAllSubjects" + AuthService_CountSubjects_FullMethodName = "/magistrala.AuthService/CountSubjects" + AuthService_ListPermissions_FullMethodName = "/magistrala.AuthService/ListPermissions" ) // AuthServiceClient is the client API for AuthService service. @@ -143,7 +143,7 @@ type AuthServiceClient interface { Authorize(ctx context.Context, in *AuthorizeReq, opts ...grpc.CallOption) (*AuthorizeRes, error) AddPolicy(ctx context.Context, in *AddPolicyReq, opts ...grpc.CallOption) (*AddPolicyRes, error) AddPolicies(ctx context.Context, in *AddPoliciesReq, opts ...grpc.CallOption) (*AddPoliciesRes, error) - DeletePolicy(ctx context.Context, in *DeletePolicyReq, opts ...grpc.CallOption) (*DeletePolicyRes, error) + DeletePolicyFilter(ctx context.Context, in *DeletePolicyFilterReq, opts ...grpc.CallOption) (*DeletePolicyFilterRes, error) DeletePolicies(ctx context.Context, in *DeletePoliciesReq, opts ...grpc.CallOption) (*DeletePoliciesRes, error) ListObjects(ctx context.Context, in *ListObjectsReq, opts ...grpc.CallOption) (*ListObjectsRes, error) ListAllObjects(ctx context.Context, in *ListObjectsReq, opts ...grpc.CallOption) (*ListObjectsRes, error) @@ -216,9 +216,9 @@ func (c *authServiceClient) AddPolicies(ctx context.Context, in *AddPoliciesReq, return out, nil } -func (c *authServiceClient) DeletePolicy(ctx context.Context, in *DeletePolicyReq, opts ...grpc.CallOption) (*DeletePolicyRes, error) { - out := new(DeletePolicyRes) - err := c.cc.Invoke(ctx, AuthService_DeletePolicy_FullMethodName, in, out, opts...) +func (c *authServiceClient) DeletePolicyFilter(ctx context.Context, in *DeletePolicyFilterReq, opts ...grpc.CallOption) (*DeletePolicyFilterRes, error) { + out := new(DeletePolicyFilterRes) + err := c.cc.Invoke(ctx, AuthService_DeletePolicyFilter_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -307,7 +307,7 @@ type AuthServiceServer interface { Authorize(context.Context, *AuthorizeReq) (*AuthorizeRes, error) AddPolicy(context.Context, *AddPolicyReq) (*AddPolicyRes, error) AddPolicies(context.Context, *AddPoliciesReq) (*AddPoliciesRes, error) - DeletePolicy(context.Context, *DeletePolicyReq) (*DeletePolicyRes, error) + DeletePolicyFilter(context.Context, *DeletePolicyFilterReq) (*DeletePolicyFilterRes, error) DeletePolicies(context.Context, *DeletePoliciesReq) (*DeletePoliciesRes, error) ListObjects(context.Context, *ListObjectsReq) (*ListObjectsRes, error) ListAllObjects(context.Context, *ListObjectsReq) (*ListObjectsRes, error) @@ -341,8 +341,8 @@ func (UnimplementedAuthServiceServer) AddPolicy(context.Context, *AddPolicyReq) func (UnimplementedAuthServiceServer) AddPolicies(context.Context, *AddPoliciesReq) (*AddPoliciesRes, error) { return nil, status.Errorf(codes.Unimplemented, "method AddPolicies not implemented") } -func (UnimplementedAuthServiceServer) DeletePolicy(context.Context, *DeletePolicyReq) (*DeletePolicyRes, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeletePolicy not implemented") +func (UnimplementedAuthServiceServer) DeletePolicyFilter(context.Context, *DeletePolicyFilterReq) (*DeletePolicyFilterRes, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeletePolicyFilter not implemented") } func (UnimplementedAuthServiceServer) DeletePolicies(context.Context, *DeletePoliciesReq) (*DeletePoliciesRes, error) { return nil, status.Errorf(codes.Unimplemented, "method DeletePolicies not implemented") @@ -489,20 +489,20 @@ func _AuthService_AddPolicies_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } -func _AuthService_DeletePolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeletePolicyReq) +func _AuthService_DeletePolicyFilter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeletePolicyFilterReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(AuthServiceServer).DeletePolicy(ctx, in) + return srv.(AuthServiceServer).DeletePolicyFilter(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: AuthService_DeletePolicy_FullMethodName, + FullMethod: AuthService_DeletePolicyFilter_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServiceServer).DeletePolicy(ctx, req.(*DeletePolicyReq)) + return srv.(AuthServiceServer).DeletePolicyFilter(ctx, req.(*DeletePolicyFilterReq)) } return interceptor(ctx, in, info, handler) } @@ -683,8 +683,8 @@ var AuthService_ServiceDesc = grpc.ServiceDesc{ Handler: _AuthService_AddPolicies_Handler, }, { - MethodName: "DeletePolicy", - Handler: _AuthService_DeletePolicy_Handler, + MethodName: "DeletePolicyFilter", + Handler: _AuthService_DeletePolicyFilter_Handler, }, { MethodName: "DeletePolicies", diff --git a/cli/domains.go b/cli/domains.go index 3610ff3d37..18c72f55b3 100644 --- a/cli/domains.go +++ b/cli/domains.go @@ -179,7 +179,7 @@ var domainAssignCmds = []cobra.Command{ Short: "Assign users", Long: "Assign users to a domain\n" + "Usage:\n" + - "\tmagistrala-cli groups assign users '[\"\", \"\"]' $TOKEN\n", + "\tmagistrala-cli domains assign users '[\"\", \"\"]' $TOKEN\n", Run: func(cmd *cobra.Command, args []string) { if len(args) != 4 { logUsage(cmd.Use) @@ -205,7 +205,7 @@ var domainUnassignCmds = []cobra.Command{ Short: "Unassign users", Long: "Unassign users from a domain\n" + "Usage:\n" + - "\tmagistrala-cli groups unassign users '[\"\", \"\"]' $TOKEN\n", + "\tmagistrala-cli domains unassign users '[\"\", \"\"]' $TOKEN\n", Run: func(cmd *cobra.Command, args []string) { if len(args) != 4 { logUsage(cmd.Use) diff --git a/internal/groups/service.go b/internal/groups/service.go index da936c7e5b..252baf51cf 100644 --- a/internal/groups/service.go +++ b/internal/groups/service.go @@ -591,7 +591,7 @@ func (svc service) DeleteGroup(ctx context.Context, token, groupID string) error } // Remove policy of child groups - if _, err := svc.auth.DeletePolicy(ctx, &magistrala.DeletePolicyReq{ + if _, err := svc.auth.DeletePolicyFilter(ctx, &magistrala.DeletePolicyFilterReq{ SubjectType: auth.GroupType, Subject: groupID, ObjectType: auth.GroupType, @@ -600,7 +600,7 @@ func (svc service) DeleteGroup(ctx context.Context, token, groupID string) error } // Remove policy of things - if _, err := svc.auth.DeletePolicy(ctx, &magistrala.DeletePolicyReq{ + if _, err := svc.auth.DeletePolicyFilter(ctx, &magistrala.DeletePolicyFilterReq{ SubjectType: auth.GroupType, Subject: groupID, ObjectType: auth.ThingType, @@ -609,7 +609,7 @@ func (svc service) DeleteGroup(ctx context.Context, token, groupID string) error } // Remove policy from domain - if _, err := svc.auth.DeletePolicy(ctx, &magistrala.DeletePolicyReq{ + if _, err := svc.auth.DeletePolicyFilter(ctx, &magistrala.DeletePolicyFilterReq{ SubjectType: auth.DomainType, Object: groupID, ObjectType: auth.GroupType, @@ -623,7 +623,7 @@ func (svc service) DeleteGroup(ctx context.Context, token, groupID string) error } // Remove policy of users - if _, err := svc.auth.DeletePolicy(ctx, &magistrala.DeletePolicyReq{ + if _, err := svc.auth.DeletePolicyFilter(ctx, &magistrala.DeletePolicyFilterReq{ SubjectType: auth.UserType, Object: groupID, ObjectType: auth.GroupType, diff --git a/internal/groups/service_test.go b/internal/groups/service_test.go index f85ffbc4eb..97fe88baa9 100644 --- a/internal/groups/service_test.go +++ b/internal/groups/service_test.go @@ -287,8 +287,8 @@ func TestCreateGroup(t *testing.T) { for _, tc := range cases { t.Run(tc.desc, func(t *testing.T) { - repocall := authsvc.On("Identify", context.Background(), &magistrala.IdentityReq{Token: tc.token}).Return(tc.idResp, tc.idErr) - authCall := authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ + authcall := authsvc.On("Identify", context.Background(), &magistrala.IdentityReq{Token: tc.token}).Return(tc.idResp, tc.idErr) + authcall1 := authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ SubjectType: auth.UserType, SubjectKind: auth.UsersKind, Subject: tc.idResp.GetId(), @@ -296,7 +296,7 @@ func TestCreateGroup(t *testing.T) { Object: tc.idResp.GetDomainId(), ObjectType: auth.DomainType, }).Return(tc.authzResp, tc.authzErr) - authCall1 := authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ + authcall2 := authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ SubjectType: auth.UserType, SubjectKind: auth.TokenKind, Subject: tc.token, @@ -304,9 +304,9 @@ func TestCreateGroup(t *testing.T) { Object: tc.group.Parent, ObjectType: auth.GroupType, }).Return(tc.authzTknResp, tc.authzTknErr) - repocall1 := repo.On("Save", context.Background(), mock.Anything).Return(tc.repoResp, tc.repoErr) - authCall2 := authsvc.On("AddPolicies", context.Background(), mock.Anything).Return(tc.addPolResp, tc.addPolErr) - authCall3 := authsvc.On("DeletePolicies", mock.Anything, mock.Anything).Return(tc.deletePolResp, tc.deletePolErr) + repocall := repo.On("Save", context.Background(), mock.Anything).Return(tc.repoResp, tc.repoErr) + authcall3 := authsvc.On("AddPolicies", context.Background(), mock.Anything).Return(tc.addPolResp, tc.addPolErr) + authCall4 := authsvc.On("DeletePolicies", mock.Anything, mock.Anything).Return(tc.deletePolResp, tc.deletePolErr) got, err := svc.CreateGroup(context.Background(), tc.token, tc.kind, tc.group) assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("expected error %v to contain %v", err, tc.err)) if err == nil { @@ -314,15 +314,15 @@ func TestCreateGroup(t *testing.T) { assert.NotEmpty(t, got.CreatedAt) assert.NotEmpty(t, got.Domain) assert.WithinDuration(t, time.Now(), got.CreatedAt, 2*time.Second) - ok := repocall1.Parent.AssertCalled(t, "Save", context.Background(), mock.Anything) + ok := repocall.Parent.AssertCalled(t, "Save", context.Background(), mock.Anything) assert.True(t, ok, fmt.Sprintf("Save was not called on %s", tc.desc)) } + authcall.Unset() + authcall1.Unset() + authcall2.Unset() repocall.Unset() - authCall.Unset() - authCall1.Unset() - repocall1.Unset() - authCall2.Unset() - authCall3.Unset() + authcall3.Unset() + authCall4.Unset() }) } } @@ -461,8 +461,8 @@ func TestViewGroupPerms(t *testing.T) { for _, tc := range cases { t.Run(tc.desc, func(t *testing.T) { - repocall := authsvc.On("Identify", context.Background(), &magistrala.IdentityReq{Token: tc.token}).Return(tc.idResp, tc.idErr) - repocall1 := authsvc.On("ListPermissions", context.Background(), &magistrala.ListPermissionsReq{ + authcall := authsvc.On("Identify", context.Background(), &magistrala.IdentityReq{Token: tc.token}).Return(tc.idResp, tc.idErr) + authcall1 := authsvc.On("ListPermissions", context.Background(), &magistrala.ListPermissionsReq{ SubjectType: auth.UserType, Subject: tc.idResp.GetId(), Object: tc.id, @@ -473,8 +473,8 @@ func TestViewGroupPerms(t *testing.T) { if err == nil { assert.Equal(t, tc.listResp.Permissions, got) } - repocall.Unset() - repocall1.Unset() + authcall.Unset() + authcall1.Unset() }) } } @@ -632,7 +632,7 @@ func TestEnableGroup(t *testing.T) { for _, tc := range cases { t.Run(tc.desc, func(t *testing.T) { - repocall := authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ + authcall := authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ SubjectType: auth.UserType, SubjectKind: auth.TokenKind, Subject: tc.token, @@ -640,8 +640,8 @@ func TestEnableGroup(t *testing.T) { Object: tc.id, ObjectType: auth.GroupType, }).Return(tc.authzResp, tc.authzErr) - repocall1 := repo.On("RetrieveByID", context.Background(), tc.id).Return(tc.retrieveResp, tc.retrieveErr) - repocall2 := repo.On("ChangeStatus", context.Background(), mock.Anything).Return(tc.changeResp, tc.changeErr) + repocall := repo.On("RetrieveByID", context.Background(), tc.id).Return(tc.retrieveResp, tc.retrieveErr) + repocall1 := repo.On("ChangeStatus", context.Background(), mock.Anything).Return(tc.changeResp, tc.changeErr) got, err := svc.EnableGroup(context.Background(), tc.token, tc.id) assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("expected error %v to contain %v", err, tc.err)) if err == nil { @@ -649,9 +649,9 @@ func TestEnableGroup(t *testing.T) { ok := repo.AssertCalled(t, "RetrieveByID", context.Background(), tc.id) assert.True(t, ok, fmt.Sprintf("RetrieveByID was not called on %s", tc.desc)) } + authcall.Unset() repocall.Unset() repocall1.Unset() - repocall2.Unset() }) } } @@ -732,7 +732,7 @@ func TestDisableGroup(t *testing.T) { for _, tc := range cases { t.Run(tc.desc, func(t *testing.T) { - repocall := authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ + authcall := authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ SubjectType: auth.UserType, SubjectKind: auth.TokenKind, Subject: tc.token, @@ -740,8 +740,8 @@ func TestDisableGroup(t *testing.T) { Object: tc.id, ObjectType: auth.GroupType, }).Return(tc.authzResp, tc.authzErr) - repocall1 := repo.On("RetrieveByID", context.Background(), tc.id).Return(tc.retrieveResp, tc.retrieveErr) - repocall2 := repo.On("ChangeStatus", context.Background(), mock.Anything).Return(tc.changeResp, tc.changeErr) + repocall := repo.On("RetrieveByID", context.Background(), tc.id).Return(tc.retrieveResp, tc.retrieveErr) + repocall1 := repo.On("ChangeStatus", context.Background(), mock.Anything).Return(tc.changeResp, tc.changeErr) got, err := svc.DisableGroup(context.Background(), tc.token, tc.id) assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("expected error %v to contain %v", err, tc.err)) if err == nil { @@ -749,9 +749,9 @@ func TestDisableGroup(t *testing.T) { ok := repo.AssertCalled(t, "RetrieveByID", context.Background(), tc.id) assert.True(t, ok, fmt.Sprintf("RetrieveByID was not called on %s", tc.desc)) } + authcall.Unset() repocall.Unset() repocall1.Unset() - repocall2.Unset() }) } } @@ -860,7 +860,7 @@ func TestListMembers(t *testing.T) { for _, tc := range cases { t.Run(tc.desc, func(t *testing.T) { - repocall := authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ + authcall := authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ SubjectType: auth.UserType, SubjectKind: auth.TokenKind, Subject: tc.token, @@ -868,13 +868,13 @@ func TestListMembers(t *testing.T) { Object: tc.groupID, ObjectType: auth.GroupType, }).Return(tc.authzResp, tc.authzErr) - repocall1 := authsvc.On("ListAllObjects", context.Background(), &magistrala.ListObjectsReq{ + authcall1 := authsvc.On("ListAllObjects", context.Background(), &magistrala.ListObjectsReq{ SubjectType: auth.GroupType, Subject: tc.groupID, Relation: auth.GroupRelation, ObjectType: auth.ThingType, }).Return(tc.listObjectResp, tc.listObjectErr) - repocall2 := authsvc.On("ListAllSubjects", context.Background(), &magistrala.ListSubjectsReq{ + authcall2 := authsvc.On("ListAllSubjects", context.Background(), &magistrala.ListSubjectsReq{ SubjectType: auth.UserType, Permission: tc.permission, Object: tc.groupID, @@ -885,9 +885,9 @@ func TestListMembers(t *testing.T) { if err == nil { assert.NotEmpty(t, got) } - repocall.Unset() - repocall1.Unset() - repocall2.Unset() + authcall.Unset() + authcall1.Unset() + authcall2.Unset() }) } } @@ -1513,14 +1513,14 @@ func TestListGroups(t *testing.T) { for _, tc := range cases { t.Run(tc.desc, func(t *testing.T) { - repocall := authsvc.On("Identify", context.Background(), &magistrala.IdentityReq{Token: tc.token}).Return(tc.idResp, tc.idErr) - repocall1 := &mock.Call{} - repocall2 := &mock.Call{} - repocall3 := &mock.Call{} + authcall := authsvc.On("Identify", context.Background(), &magistrala.IdentityReq{Token: tc.token}).Return(tc.idResp, tc.idErr) + authcall1 := &mock.Call{} + authcall2 := &mock.Call{} + authcall3 := &mock.Call{} adminCheck := &mock.Call{} switch tc.memberKind { case auth.ThingsKind: - repocall1 = authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ + authcall1 = authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ Domain: tc.idResp.GetDomainId(), SubjectType: auth.UserType, SubjectKind: auth.UsersKind, @@ -1529,20 +1529,20 @@ func TestListGroups(t *testing.T) { Object: tc.memberID, ObjectType: auth.ThingType, }).Return(tc.authzResp, tc.authzErr) - repocall2 = authsvc.On("ListAllSubjects", context.Background(), &magistrala.ListSubjectsReq{ + authcall2 = authsvc.On("ListAllSubjects", context.Background(), &magistrala.ListSubjectsReq{ SubjectType: auth.GroupType, Permission: auth.GroupRelation, ObjectType: auth.ThingType, Object: tc.memberID, }).Return(tc.listSubjectResp, tc.listSubjectErr) - repocall3 = authsvc.On("ListAllObjects", context.Background(), &magistrala.ListObjectsReq{ + authcall3 = authsvc.On("ListAllObjects", context.Background(), &magistrala.ListObjectsReq{ SubjectType: auth.UserType, Subject: tc.idResp.GetId(), Permission: tc.page.Permission, ObjectType: auth.GroupType, }).Return(tc.listObjectFilterResp, tc.listObjectFilterErr) case auth.GroupsKind: - repocall1 = authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ + authcall1 = authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ Domain: tc.idResp.GetDomainId(), SubjectType: auth.UserType, SubjectKind: auth.UsersKind, @@ -1551,20 +1551,20 @@ func TestListGroups(t *testing.T) { Object: tc.memberID, ObjectType: auth.GroupType, }).Return(tc.authzResp, tc.authzErr) - repocall2 = authsvc.On("ListAllObjects", context.Background(), &magistrala.ListObjectsReq{ + authcall2 = authsvc.On("ListAllObjects", context.Background(), &magistrala.ListObjectsReq{ SubjectType: auth.GroupType, Subject: tc.memberID, Permission: auth.ParentGroupRelation, ObjectType: auth.GroupType, }).Return(tc.listObjectResp, tc.listObjectErr) - repocall3 = authsvc.On("ListAllObjects", context.Background(), &magistrala.ListObjectsReq{ + authcall3 = authsvc.On("ListAllObjects", context.Background(), &magistrala.ListObjectsReq{ SubjectType: auth.UserType, Subject: tc.idResp.GetId(), Permission: tc.page.Permission, ObjectType: auth.GroupType, }).Return(tc.listObjectFilterResp, tc.listObjectFilterErr) case auth.ChannelsKind: - repocall1 = authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ + authcall1 = authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ Domain: tc.idResp.GetDomainId(), SubjectType: auth.UserType, SubjectKind: auth.UsersKind, @@ -1573,13 +1573,13 @@ func TestListGroups(t *testing.T) { Object: tc.memberID, ObjectType: auth.GroupType, }).Return(tc.authzResp, tc.authzErr) - repocall2 = authsvc.On("ListAllSubjects", context.Background(), &magistrala.ListSubjectsReq{ + authcall2 = authsvc.On("ListAllSubjects", context.Background(), &magistrala.ListSubjectsReq{ SubjectType: auth.GroupType, Permission: auth.ParentGroupRelation, ObjectType: auth.GroupType, Object: tc.memberID, }).Return(tc.listSubjectResp, tc.listSubjectErr) - repocall3 = authsvc.On("ListAllObjects", context.Background(), &magistrala.ListObjectsReq{ + authcall3 = authsvc.On("ListAllObjects", context.Background(), &magistrala.ListObjectsReq{ SubjectType: auth.UserType, Subject: tc.idResp.GetId(), Permission: tc.page.Permission, @@ -1607,39 +1607,39 @@ func TestListGroups(t *testing.T) { authReq.Domain = "" authReq.Permission = auth.MembershipPermission } - repocall1 = authsvc.On("Authorize", context.Background(), authReq).Return(tc.authzResp, tc.authzErr) - repocall2 = authsvc.On("ListAllObjects", context.Background(), &magistrala.ListObjectsReq{ + authcall1 = authsvc.On("Authorize", context.Background(), authReq).Return(tc.authzResp, tc.authzErr) + authcall2 = authsvc.On("ListAllObjects", context.Background(), &magistrala.ListObjectsReq{ SubjectType: auth.UserType, Subject: auth.EncodeDomainUserID(tc.idResp.GetDomainId(), tc.memberID), Permission: tc.page.Permission, ObjectType: auth.GroupType, }).Return(tc.listObjectResp, tc.listObjectErr) - repocall3 = authsvc.On("ListAllObjects", context.Background(), &magistrala.ListObjectsReq{ + authcall3 = authsvc.On("ListAllObjects", context.Background(), &magistrala.ListObjectsReq{ SubjectType: auth.UserType, Subject: tc.idResp.GetId(), Permission: tc.page.Permission, ObjectType: auth.GroupType, }).Return(tc.listObjectFilterResp, tc.listObjectFilterErr) } - repocall4 := repo.On("RetrieveByIDs", context.Background(), mock.Anything, mock.Anything).Return(tc.repoResp, tc.repoErr) - repocall5 := authsvc.On("ListPermissions", mock.Anything, mock.Anything).Return(tc.listPermResp, tc.listPermErr) + repocall := repo.On("RetrieveByIDs", context.Background(), mock.Anything, mock.Anything).Return(tc.repoResp, tc.repoErr) + authcall4 := authsvc.On("ListPermissions", mock.Anything, mock.Anything).Return(tc.listPermResp, tc.listPermErr) got, err := svc.ListGroups(context.Background(), tc.token, tc.memberKind, tc.memberID, tc.page) assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("expected error %v to contain %v", err, tc.err)) if err == nil { assert.NotEmpty(t, got) } + authcall.Unset() repocall.Unset() switch tc.memberKind { case auth.ThingsKind, auth.GroupsKind, auth.ChannelsKind, auth.UsersKind: - repocall1.Unset() - repocall2.Unset() - repocall3.Unset() + authcall1.Unset() + authcall2.Unset() + authcall3.Unset() + authcall4.Unset() if tc.memberID == "" { adminCheck.Unset() } } - repocall4.Unset() - repocall5.Unset() }) } } @@ -1965,8 +1965,8 @@ func TestAssign(t *testing.T) { for _, tc := range cases { t.Run(tc.desc, func(t *testing.T) { - repocall := authsvc.On("Identify", context.Background(), &magistrala.IdentityReq{Token: tc.token}).Return(tc.idResp, tc.idErr) - repocall1 := authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ + authcall := authsvc.On("Identify", context.Background(), &magistrala.IdentityReq{Token: tc.token}).Return(tc.idResp, tc.idErr) + authcall1 := authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ Domain: tc.idResp.GetDomainId(), SubjectType: auth.UserType, SubjectKind: auth.UsersKind, @@ -2038,12 +2038,12 @@ func TestAssign(t *testing.T) { }) } } - repocall2 := authsvc.On("AddPolicies", context.Background(), &policies).Return(tc.addPoliciesRes, tc.addPoliciesErr) + authcall2 := authsvc.On("AddPolicies", context.Background(), &policies).Return(tc.addPoliciesRes, tc.addPoliciesErr) err := svc.Assign(context.Background(), tc.token, tc.groupID, tc.relation, tc.memberKind, tc.memberIDs...) assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("expected error %v to contain %v", err, tc.err)) - repocall.Unset() - repocall1.Unset() - repocall2.Unset() + authcall.Unset() + authcall1.Unset() + authcall2.Unset() if tc.memberKind == auth.GroupsKind { retrieveByIDsCall.Unset() deletePoliciesCall.Unset() @@ -2374,8 +2374,8 @@ func TestUnassign(t *testing.T) { for _, tc := range cases { t.Run(tc.desc, func(t *testing.T) { - repocall := authsvc.On("Identify", context.Background(), &magistrala.IdentityReq{Token: tc.token}).Return(tc.idResp, tc.idErr) - repocall1 := authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ + authcall := authsvc.On("Identify", context.Background(), &magistrala.IdentityReq{Token: tc.token}).Return(tc.idResp, tc.idErr) + authcall1 := authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ Domain: tc.idResp.GetDomainId(), SubjectType: auth.UserType, SubjectKind: auth.UsersKind, @@ -2447,12 +2447,12 @@ func TestUnassign(t *testing.T) { }) } } - repocall2 := authsvc.On("DeletePolicies", context.Background(), &policies).Return(tc.deletePoliciesRes, tc.deletePoliciesErr) + authcall2 := authsvc.On("DeletePolicies", context.Background(), &policies).Return(tc.deletePoliciesRes, tc.deletePoliciesErr) err := svc.Unassign(context.Background(), tc.token, tc.groupID, tc.relation, tc.memberKind, tc.memberIDs...) assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("expected error %v to contain %v", err, tc.err)) - repocall.Unset() - repocall1.Unset() - repocall2.Unset() + authcall.Unset() + authcall1.Unset() + authcall2.Unset() if tc.memberKind == auth.GroupsKind { retrieveByIDsCall.Unset() addPoliciesCall.Unset() @@ -2475,13 +2475,13 @@ func TestDeleteGroup(t *testing.T) { idErr error authzResp *magistrala.AuthorizeRes authzErr error - deleteChildPoliciesRes *magistrala.DeletePolicyRes + deleteChildPoliciesRes *magistrala.DeletePolicyFilterRes deleteChildPoliciesErr error - deleteThingsPoliciesRes *magistrala.DeletePolicyRes + deleteThingsPoliciesRes *magistrala.DeletePolicyFilterRes deleteThingsPoliciesErr error - deleteDomainsPoliciesRes *magistrala.DeletePolicyRes + deleteDomainsPoliciesRes *magistrala.DeletePolicyFilterRes deleteDomainsPoliciesErr error - deleteUsersPoliciesRes *magistrala.DeletePolicyRes + deleteUsersPoliciesRes *magistrala.DeletePolicyFilterRes deleteUsersPoliciesErr error repoErr error err error @@ -2497,16 +2497,16 @@ func TestDeleteGroup(t *testing.T) { authzResp: &magistrala.AuthorizeRes{ Authorized: true, }, - deleteChildPoliciesRes: &magistrala.DeletePolicyRes{ + deleteChildPoliciesRes: &magistrala.DeletePolicyFilterRes{ Deleted: true, }, - deleteThingsPoliciesRes: &magistrala.DeletePolicyRes{ + deleteThingsPoliciesRes: &magistrala.DeletePolicyFilterRes{ Deleted: true, }, - deleteDomainsPoliciesRes: &magistrala.DeletePolicyRes{ + deleteDomainsPoliciesRes: &magistrala.DeletePolicyFilterRes{ Deleted: true, }, - deleteUsersPoliciesRes: &magistrala.DeletePolicyRes{ + deleteUsersPoliciesRes: &magistrala.DeletePolicyFilterRes{ Deleted: true, }, }, @@ -2543,7 +2543,7 @@ func TestDeleteGroup(t *testing.T) { authzResp: &magistrala.AuthorizeRes{ Authorized: true, }, - deleteChildPoliciesRes: &magistrala.DeletePolicyRes{ + deleteChildPoliciesRes: &magistrala.DeletePolicyFilterRes{ Deleted: false, }, deleteChildPoliciesErr: svcerr.ErrAuthorization, @@ -2560,10 +2560,10 @@ func TestDeleteGroup(t *testing.T) { authzResp: &magistrala.AuthorizeRes{ Authorized: true, }, - deleteChildPoliciesRes: &magistrala.DeletePolicyRes{ + deleteChildPoliciesRes: &magistrala.DeletePolicyFilterRes{ Deleted: true, }, - deleteThingsPoliciesRes: &magistrala.DeletePolicyRes{ + deleteThingsPoliciesRes: &magistrala.DeletePolicyFilterRes{ Deleted: false, }, deleteThingsPoliciesErr: svcerr.ErrAuthorization, @@ -2580,13 +2580,13 @@ func TestDeleteGroup(t *testing.T) { authzResp: &magistrala.AuthorizeRes{ Authorized: true, }, - deleteChildPoliciesRes: &magistrala.DeletePolicyRes{ + deleteChildPoliciesRes: &magistrala.DeletePolicyFilterRes{ Deleted: true, }, - deleteThingsPoliciesRes: &magistrala.DeletePolicyRes{ + deleteThingsPoliciesRes: &magistrala.DeletePolicyFilterRes{ Deleted: true, }, - deleteDomainsPoliciesRes: &magistrala.DeletePolicyRes{ + deleteDomainsPoliciesRes: &magistrala.DeletePolicyFilterRes{ Deleted: false, }, deleteDomainsPoliciesErr: svcerr.ErrAuthorization, @@ -2603,16 +2603,16 @@ func TestDeleteGroup(t *testing.T) { authzResp: &magistrala.AuthorizeRes{ Authorized: true, }, - deleteChildPoliciesRes: &magistrala.DeletePolicyRes{ + deleteChildPoliciesRes: &magistrala.DeletePolicyFilterRes{ Deleted: true, }, - deleteThingsPoliciesRes: &magistrala.DeletePolicyRes{ + deleteThingsPoliciesRes: &magistrala.DeletePolicyFilterRes{ Deleted: true, }, - deleteDomainsPoliciesRes: &magistrala.DeletePolicyRes{ + deleteDomainsPoliciesRes: &magistrala.DeletePolicyFilterRes{ Deleted: true, }, - deleteUsersPoliciesRes: &magistrala.DeletePolicyRes{ + deleteUsersPoliciesRes: &magistrala.DeletePolicyFilterRes{ Deleted: false, }, deleteUsersPoliciesErr: svcerr.ErrAuthorization, @@ -2629,13 +2629,13 @@ func TestDeleteGroup(t *testing.T) { authzResp: &magistrala.AuthorizeRes{ Authorized: true, }, - deleteChildPoliciesRes: &magistrala.DeletePolicyRes{ + deleteChildPoliciesRes: &magistrala.DeletePolicyFilterRes{ Deleted: true, }, - deleteThingsPoliciesRes: &magistrala.DeletePolicyRes{ + deleteThingsPoliciesRes: &magistrala.DeletePolicyFilterRes{ Deleted: true, }, - deleteDomainsPoliciesRes: &magistrala.DeletePolicyRes{ + deleteDomainsPoliciesRes: &magistrala.DeletePolicyFilterRes{ Deleted: true, }, repoErr: repoerr.ErrNotFound, @@ -2645,8 +2645,8 @@ func TestDeleteGroup(t *testing.T) { for _, tc := range cases { t.Run(tc.desc, func(t *testing.T) { - repocall := authsvc.On("Identify", context.Background(), &magistrala.IdentityReq{Token: tc.token}).Return(tc.idResp, tc.idErr) - repocall1 := authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ + authcall := authsvc.On("Identify", context.Background(), &magistrala.IdentityReq{Token: tc.token}).Return(tc.idResp, tc.idErr) + authcall1 := authsvc.On("Authorize", context.Background(), &magistrala.AuthorizeReq{ Domain: tc.idResp.GetDomainId(), SubjectType: auth.UserType, SubjectKind: auth.UsersKind, @@ -2655,36 +2655,36 @@ func TestDeleteGroup(t *testing.T) { Object: tc.groupID, ObjectType: auth.GroupType, }).Return(tc.authzResp, tc.authzErr) - repocall2 := authsvc.On("DeletePolicy", context.Background(), &magistrala.DeletePolicyReq{ + authcall2 := authsvc.On("DeletePolicyFilter", context.Background(), &magistrala.DeletePolicyFilterReq{ SubjectType: auth.GroupType, Subject: tc.groupID, ObjectType: auth.GroupType, }).Return(tc.deleteChildPoliciesRes, tc.deleteChildPoliciesErr) - repocall3 := authsvc.On("DeletePolicy", context.Background(), &magistrala.DeletePolicyReq{ + authcall3 := authsvc.On("DeletePolicyFilter", context.Background(), &magistrala.DeletePolicyFilterReq{ SubjectType: auth.GroupType, Subject: tc.groupID, ObjectType: auth.ThingType, }).Return(tc.deleteThingsPoliciesRes, tc.deleteThingsPoliciesErr) - repocall4 := authsvc.On("DeletePolicy", context.Background(), &magistrala.DeletePolicyReq{ + authcall4 := authsvc.On("DeletePolicyFilter", context.Background(), &magistrala.DeletePolicyFilterReq{ SubjectType: auth.DomainType, Object: tc.groupID, ObjectType: auth.GroupType, }).Return(tc.deleteDomainsPoliciesRes, tc.deleteDomainsPoliciesErr) - repocall5 := repo.On("Delete", context.Background(), tc.groupID).Return(tc.repoErr) - repocall6 := authsvc.On("DeletePolicy", context.Background(), &magistrala.DeletePolicyReq{ + authcall5 := repo.On("Delete", context.Background(), tc.groupID).Return(tc.repoErr) + authcall6 := authsvc.On("DeletePolicyFilter", context.Background(), &magistrala.DeletePolicyFilterReq{ SubjectType: auth.UserType, Object: tc.groupID, ObjectType: auth.GroupType, }).Return(tc.deleteUsersPoliciesRes, tc.deleteUsersPoliciesErr) err := svc.DeleteGroup(context.Background(), tc.token, tc.groupID) assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("expected error %v to contain %v", err, tc.err)) - repocall.Unset() - repocall1.Unset() - repocall2.Unset() - repocall3.Unset() - repocall4.Unset() - repocall5.Unset() - repocall6.Unset() + authcall.Unset() + authcall1.Unset() + authcall2.Unset() + authcall3.Unset() + authcall4.Unset() + authcall5.Unset() + authcall6.Unset() }) } } diff --git a/pkg/sdk/go/channels_test.go b/pkg/sdk/go/channels_test.go index 1b9928c728..13f3e12dc2 100644 --- a/pkg/sdk/go/channels_test.go +++ b/pkg/sdk/go/channels_test.go @@ -262,14 +262,14 @@ func TestListChannels(t *testing.T) { } for _, tc := range cases { - repoCall := auth.On("Identify", mock.Anything, &magistrala.IdentityReq{Token: tc.token}).Return(&magistrala.IdentityRes{Id: validID, DomainId: testsutil.GenerateUUID(t)}, nil) - repoCall1 := auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) + authCall := auth.On("Identify", mock.Anything, &magistrala.IdentityReq{Token: tc.token}).Return(&magistrala.IdentityRes{Id: validID, DomainId: testsutil.GenerateUUID(t)}, nil) + authCall1 := auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) if tc.token == invalidToken { - repoCall = auth.On("Identify", mock.Anything, &magistrala.IdentityReq{Token: invalidToken}).Return(&magistrala.IdentityRes{}, svcerr.ErrAuthentication) - repoCall1 = auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: false}, svcerr.ErrAuthorization) + authCall = auth.On("Identify", mock.Anything, &magistrala.IdentityReq{Token: invalidToken}).Return(&magistrala.IdentityRes{}, svcerr.ErrAuthentication) + authCall1 = auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: false}, svcerr.ErrAuthorization) } - repoCall2 := auth.On("ListAllObjects", mock.Anything, mock.Anything).Return(&magistrala.ListObjectsRes{Policies: toIDs(tc.response)}, nil) - repoCall3 := grepo.On("RetrieveByIDs", mock.Anything, mock.Anything, mock.Anything).Return(mggroups.Page{Groups: convertChannels(tc.response)}, tc.err) + authCall2 := auth.On("ListAllObjects", mock.Anything, mock.Anything).Return(&magistrala.ListObjectsRes{Policies: toIDs(tc.response)}, nil) + repoCall := grepo.On("RetrieveByIDs", mock.Anything, mock.Anything, mock.Anything).Return(mggroups.Page{Groups: convertChannels(tc.response)}, tc.err) pm := sdk.PageMetadata{ Offset: tc.offset, Limit: tc.limit, @@ -279,13 +279,13 @@ func TestListChannels(t *testing.T) { assert.Equal(t, tc.err, err, fmt.Sprintf("%s: expected error %s, got %s", tc.desc, tc.err, err)) assert.Equal(t, len(tc.response), len(page.Channels), fmt.Sprintf("%s: expected %v got %v\n", tc.desc, tc.response, page)) if tc.err == nil { - ok := repoCall3.Parent.AssertCalled(t, "RetrieveByIDs", mock.Anything, mock.Anything, mock.Anything) + ok := repoCall.Parent.AssertCalled(t, "RetrieveByIDs", mock.Anything, mock.Anything, mock.Anything) assert.True(t, ok, fmt.Sprintf("RetrieveByIDs was not called on %s", tc.desc)) } + authCall.Unset() + authCall1.Unset() + authCall2.Unset() repoCall.Unset() - repoCall1.Unset() - repoCall2.Unset() - repoCall3.Unset() } } @@ -338,8 +338,8 @@ func TestViewChannel(t *testing.T) { } for _, tc := range cases { - repoCall := auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) - repoCall1 := grepo.On("RetrieveByID", mock.Anything, tc.channelID).Return(convertChannel(tc.response), tc.err) + authCall := auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) + repoCall := grepo.On("RetrieveByID", mock.Anything, tc.channelID).Return(convertChannel(tc.response), tc.err) grp, err := mgsdk.Channel(tc.channelID, tc.token) assert.Equal(t, tc.err, err, fmt.Sprintf("%s: expected error %s, got %s", tc.desc, tc.err, err)) if len(tc.response.Children) == 0 { @@ -350,11 +350,11 @@ func TestViewChannel(t *testing.T) { } assert.Equal(t, tc.response, grp, fmt.Sprintf("%s: expected metadata %v got %v\n", tc.desc, tc.response, grp)) if tc.err == nil { - ok := repoCall1.Parent.AssertCalled(t, "RetrieveByID", mock.Anything, tc.channelID) + ok := repoCall.Parent.AssertCalled(t, "RetrieveByID", mock.Anything, tc.channelID) assert.True(t, ok, fmt.Sprintf("RetrieveByID was not called on %s", tc.desc)) } + authCall.Unset() repoCall.Unset() - repoCall1.Unset() } } @@ -505,16 +505,16 @@ func TestUpdateChannel(t *testing.T) { } for _, tc := range cases { - repoCall := auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) - repoCall1 := grepo.On("Update", mock.Anything, mock.Anything).Return(convertChannel(tc.response), tc.err) + authCall := auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) + repoCall := grepo.On("Update", mock.Anything, mock.Anything).Return(convertChannel(tc.response), tc.err) _, err := mgsdk.UpdateChannel(tc.channel, tc.token) assert.Equal(t, tc.err, err, fmt.Sprintf("%s: expected error %s, got %s", tc.desc, tc.err, err)) if tc.err == nil { - ok := repoCall1.Parent.AssertCalled(t, "Update", mock.Anything, mock.Anything) + ok := repoCall.Parent.AssertCalled(t, "Update", mock.Anything, mock.Anything) assert.True(t, ok, fmt.Sprintf("Update was not called on %s", tc.desc)) } + authCall.Unset() repoCall.Unset() - repoCall1.Unset() } } @@ -623,19 +623,19 @@ func TestListChannelsByThing(t *testing.T) { } for _, tc := range cases { - repoCall := auth.On("Identify", mock.Anything, &magistrala.IdentityReq{Token: tc.token}).Return(&magistrala.IdentityRes{Id: validID, DomainId: testsutil.GenerateUUID(t)}, nil) - repoCall1 := auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) - repoCall2 := auth.On("ListAllSubjects", mock.Anything, mock.Anything).Return(&magistrala.ListSubjectsRes{Policies: toIDs(tc.response)}, nil) - repoCall3 := auth.On("ListAllObjects", mock.Anything, mock.Anything).Return(&magistrala.ListObjectsRes{Policies: toIDs(tc.response)}, nil) - repoCall4 := grepo.On("RetrieveByIDs", mock.Anything, mock.Anything, mock.Anything).Return(mggroups.Page{Groups: convertChannels(tc.response)}, tc.err) + authCall := auth.On("Identify", mock.Anything, &magistrala.IdentityReq{Token: tc.token}).Return(&magistrala.IdentityRes{Id: validID, DomainId: testsutil.GenerateUUID(t)}, nil) + authCall1 := auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) + authCall2 := auth.On("ListAllSubjects", mock.Anything, mock.Anything).Return(&magistrala.ListSubjectsRes{Policies: toIDs(tc.response)}, nil) + authCall3 := auth.On("ListAllObjects", mock.Anything, mock.Anything).Return(&magistrala.ListObjectsRes{Policies: toIDs(tc.response)}, nil) + repoCall := grepo.On("RetrieveByIDs", mock.Anything, mock.Anything, mock.Anything).Return(mggroups.Page{Groups: convertChannels(tc.response)}, tc.err) page, err := mgsdk.ChannelsByThing(tc.clientID, tc.page, tc.token) assert.Equal(t, tc.err, err, fmt.Sprintf("%s: expected error %s, got %s", tc.desc, tc.err, err)) assert.Equal(t, tc.response, page.Channels, fmt.Sprintf("%s: expected %v got %v\n", tc.desc, tc.response, page.Channels)) + authCall.Unset() + authCall1.Unset() + authCall2.Unset() + authCall3.Unset() repoCall.Unset() - repoCall1.Unset() - repoCall2.Unset() - repoCall3.Unset() - repoCall4.Unset() } } @@ -657,16 +657,16 @@ func TestEnableChannel(t *testing.T) { Status: mgclients.Disabled, } - repoCall := auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) - repoCall1 := grepo.On("RetrieveByID", mock.Anything, mock.Anything).Return(mggroups.Group{}, repoerr.ErrNotFound) - repoCall2 := grepo.On("ChangeStatus", mock.Anything, mock.Anything).Return(nil) + authCall := auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) + repoCall := grepo.On("RetrieveByID", mock.Anything, mock.Anything).Return(mggroups.Group{}, repoerr.ErrNotFound) + repoCall1 := grepo.On("ChangeStatus", mock.Anything, mock.Anything).Return(nil) _, err := mgsdk.EnableChannel("wrongID", validToken) assert.Equal(t, errors.NewSDKErrorWithStatus(svcerr.ErrViewEntity, http.StatusBadRequest), err, fmt.Sprintf("Enable channel with wrong id: expected %v got %v", svcerr.ErrViewEntity, err)) - ok := repoCall1.Parent.AssertCalled(t, "RetrieveByID", mock.Anything, "wrongID") + ok := repoCall.Parent.AssertCalled(t, "RetrieveByID", mock.Anything, "wrongID") assert.True(t, ok, "RetrieveByID was not called on enabling channel") + authCall.Unset() repoCall.Unset() repoCall1.Unset() - repoCall2.Unset() ch := mggroups.Group{ ID: channel.ID, @@ -675,19 +675,19 @@ func TestEnableChannel(t *testing.T) { UpdatedAt: creationTime, Status: mgclients.DisabledStatus, } - repoCall = auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) - repoCall1 = grepo.On("RetrieveByID", mock.Anything, mock.Anything).Return(ch, nil) - repoCall2 = grepo.On("ChangeStatus", mock.Anything, mock.Anything).Return(ch, nil) + authCall = auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) + repoCall = grepo.On("RetrieveByID", mock.Anything, mock.Anything).Return(ch, nil) + repoCall1 = grepo.On("ChangeStatus", mock.Anything, mock.Anything).Return(ch, nil) res, err := mgsdk.EnableChannel(channel.ID, validToken) assert.Nil(t, err, fmt.Sprintf("Enable channel with correct id: expected %v got %v", nil, err)) assert.Equal(t, channel, res, fmt.Sprintf("Enable channel with correct id: expected %v got %v", channel, res)) - ok = repoCall1.Parent.AssertCalled(t, "RetrieveByID", mock.Anything, channel.ID) + ok = repoCall.Parent.AssertCalled(t, "RetrieveByID", mock.Anything, channel.ID) assert.True(t, ok, "RetrieveByID was not called on enabling channel") - ok = repoCall2.Parent.AssertCalled(t, "ChangeStatus", mock.Anything, mock.Anything) + ok = repoCall1.Parent.AssertCalled(t, "ChangeStatus", mock.Anything, mock.Anything) assert.True(t, ok, "ChangeStatus was not called on enabling channel") + authCall.Unset() repoCall.Unset() repoCall1.Unset() - repoCall2.Unset() } func TestDisableChannel(t *testing.T) { @@ -709,16 +709,16 @@ func TestDisableChannel(t *testing.T) { Status: mgclients.Enabled, } - repoCall := auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) - repoCall1 := grepo.On("ChangeStatus", mock.Anything, mock.Anything).Return(nil) - repoCall2 := grepo.On("RetrieveByID", mock.Anything, mock.Anything).Return(mggroups.Group{}, repoerr.ErrNotFound) + authCall := auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) + repoCall := grepo.On("ChangeStatus", mock.Anything, mock.Anything).Return(nil) + repoCall1 := grepo.On("RetrieveByID", mock.Anything, mock.Anything).Return(mggroups.Group{}, repoerr.ErrNotFound) _, err := mgsdk.DisableChannel("wrongID", validToken) assert.Equal(t, err, errors.NewSDKErrorWithStatus(svcerr.ErrViewEntity, http.StatusBadRequest), fmt.Sprintf("Disable channel with wrong id: expected %v got %v", svcerr.ErrNotFound, err)) - ok := repoCall1.Parent.AssertCalled(t, "RetrieveByID", mock.Anything, "wrongID") + ok := repoCall.Parent.AssertCalled(t, "RetrieveByID", mock.Anything, "wrongID") assert.True(t, ok, "Memberships was not called on disabling channel with wrong id") + authCall.Unset() repoCall.Unset() repoCall1.Unset() - repoCall2.Unset() ch := mggroups.Group{ ID: channel.ID, @@ -729,19 +729,19 @@ func TestDisableChannel(t *testing.T) { Status: mgclients.EnabledStatus, } - repoCall = auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) - repoCall1 = grepo.On("ChangeStatus", mock.Anything, mock.Anything).Return(ch, nil) - repoCall2 = grepo.On("RetrieveByID", mock.Anything, mock.Anything).Return(ch, nil) + authCall = auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) + repoCall = grepo.On("ChangeStatus", mock.Anything, mock.Anything).Return(ch, nil) + repoCall1 = grepo.On("RetrieveByID", mock.Anything, mock.Anything).Return(ch, nil) res, err := mgsdk.DisableChannel(channel.ID, validToken) assert.Nil(t, err, fmt.Sprintf("Disable channel with correct id: expected %v got %v", nil, err)) assert.Equal(t, channel, res, fmt.Sprintf("Disable channel with correct id: expected %v got %v", channel, res)) - ok = repoCall1.Parent.AssertCalled(t, "RetrieveByID", mock.Anything, channel.ID) + ok = repoCall.Parent.AssertCalled(t, "RetrieveByID", mock.Anything, channel.ID) assert.True(t, ok, "RetrieveByID was not called on disabling channel with correct id") - ok = repoCall2.Parent.AssertCalled(t, "ChangeStatus", mock.Anything, mock.Anything) + ok = repoCall1.Parent.AssertCalled(t, "ChangeStatus", mock.Anything, mock.Anything) assert.True(t, ok, "ChangeStatus was not called on disabling channel with correct id") + authCall.Unset() repoCall.Unset() repoCall1.Unset() - repoCall2.Unset() } func TestDeleteChannel(t *testing.T) { @@ -762,27 +762,27 @@ func TestDeleteChannel(t *testing.T) { Status: mgclients.Enabled, } - repoCall := auth.On("Identify", mock.Anything, &magistrala.IdentityReq{Token: validToken}).Return(&magistrala.IdentityRes{Id: validID, DomainId: testsutil.GenerateUUID(t)}, nil) - repoCall1 := auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: false}, nil) - repoCall2 := grepo.On("Delete", mock.Anything, mock.Anything).Return(nil) + authCall := auth.On("Identify", mock.Anything, &magistrala.IdentityReq{Token: validToken}).Return(&magistrala.IdentityRes{Id: validID, DomainId: testsutil.GenerateUUID(t)}, nil) + authCall1 := auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: false}, nil) + repoCall := grepo.On("Delete", mock.Anything, mock.Anything).Return(nil) err := mgsdk.DeleteChannel("wrongID", validToken) assert.Equal(t, err, errors.NewSDKErrorWithStatus(svcerr.ErrAuthorization, http.StatusForbidden), fmt.Sprintf("Delete channel with wrong id: expected %v got %v", svcerr.ErrNotFound, err)) + authCall.Unset() + authCall1.Unset() repoCall.Unset() - repoCall1.Unset() - repoCall2.Unset() - repoCall = auth.On("DeletePolicy", mock.Anything, mock.Anything, mock.Anything).Return(&magistrala.DeletePolicyRes{Deleted: true}, nil) - repoCall1 = auth.On("Identify", mock.Anything, &magistrala.IdentityReq{Token: validToken}).Return(&magistrala.IdentityRes{Id: validID, DomainId: testsutil.GenerateUUID(t)}, nil) - repoCall2 = auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) - repoCall3 := grepo.On("Delete", mock.Anything, mock.Anything).Return(nil) + authCall = auth.On("DeletePolicyFilter", mock.Anything, mock.Anything, mock.Anything).Return(&magistrala.DeletePolicyFilterRes{Deleted: true}, nil) + authCall1 = auth.On("Identify", mock.Anything, &magistrala.IdentityReq{Token: validToken}).Return(&magistrala.IdentityRes{Id: validID, DomainId: testsutil.GenerateUUID(t)}, nil) + authCall2 := auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) + repoCall = grepo.On("Delete", mock.Anything, mock.Anything).Return(nil) err = mgsdk.DeleteChannel(channel.ID, validToken) assert.Nil(t, err, fmt.Sprintf("Delete channel with correct id: expected %v got %v", nil, err)) - ok := repoCall3.Parent.AssertCalled(t, "Delete", mock.Anything, channel.ID) + ok := repoCall.Parent.AssertCalled(t, "Delete", mock.Anything, channel.ID) assert.True(t, ok, "Delete was not called on deleting channel with correct id") + authCall.Unset() + authCall1.Unset() + authCall2.Unset() repoCall.Unset() - repoCall1.Unset() - repoCall2.Unset() - repoCall3.Unset() } func toIDs(objects interface{}) []string { diff --git a/pkg/sdk/go/things_test.go b/pkg/sdk/go/things_test.go index 6a24fedee4..1edae693e8 100644 --- a/pkg/sdk/go/things_test.go +++ b/pkg/sdk/go/things_test.go @@ -1282,7 +1282,7 @@ func TestDeleteThing(t *testing.T) { repoCall1.Unset() repoCall2.Unset() - repoCall = auth.On("DeletePolicy", mock.Anything, mock.Anything, mock.Anything).Return(&magistrala.DeletePolicyRes{Deleted: true}, nil) + repoCall = auth.On("DeletePolicyFilter", mock.Anything, mock.Anything, mock.Anything).Return(&magistrala.DeletePolicyFilterRes{Deleted: true}, nil) repoCall1 = auth.On("Identify", mock.Anything, &magistrala.IdentityReq{Token: validToken}).Return(&magistrala.IdentityRes{Id: validID, DomainId: testsutil.GenerateUUID(t)}, nil) repoCall2 = auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) repoCall3 := cRepo.On("Delete", mock.Anything, mock.Anything).Return(nil) diff --git a/pkg/sdk/go/users_test.go b/pkg/sdk/go/users_test.go index e8d4604ed8..0878ed87cb 100644 --- a/pkg/sdk/go/users_test.go +++ b/pkg/sdk/go/users_test.go @@ -957,7 +957,7 @@ func TestUpdateClientRole(t *testing.T) { repoCall = auth.On("Identify", mock.Anything, mock.Anything).Return(&magistrala.IdentityRes{}, svcerr.ErrAuthentication) } repoCall1 := auth.On("Authorize", mock.Anything, mock.Anything).Return(&magistrala.AuthorizeRes{Authorized: true}, nil) - repoCall2 := auth.On("DeletePolicy", mock.Anything, mock.Anything).Return(&magistrala.DeletePolicyRes{Deleted: true}, nil) + repoCall2 := auth.On("DeletePolicyFilter", mock.Anything, mock.Anything).Return(&magistrala.DeletePolicyFilterRes{Deleted: true}, nil) repoCall3 := auth.On("AddPolicy", mock.Anything, mock.Anything).Return(&magistrala.AddPolicyRes{Added: true}, nil) repoCall4 := crepo.On("UpdateRole", mock.Anything, mock.Anything).Return(convertClient(tc.response), tc.err) uClient, err := mgsdk.UpdateUserRole(tc.client, tc.token) diff --git a/things/service.go b/things/service.go index 741d2550ec..25e8326201 100644 --- a/things/service.go +++ b/things/service.go @@ -444,7 +444,7 @@ func (svc service) DeleteClient(ctx context.Context, token, id string) error { } // Remove policy of groups - if _, err := svc.auth.DeletePolicy(ctx, &magistrala.DeletePolicyReq{ + if _, err := svc.auth.DeletePolicyFilter(ctx, &magistrala.DeletePolicyFilterReq{ SubjectType: auth.GroupType, Object: id, ObjectType: auth.ThingType, @@ -453,7 +453,7 @@ func (svc service) DeleteClient(ctx context.Context, token, id string) error { } // Remove policy from domain - if _, err := svc.auth.DeletePolicy(ctx, &magistrala.DeletePolicyReq{ + if _, err := svc.auth.DeletePolicyFilter(ctx, &magistrala.DeletePolicyFilterReq{ SubjectType: auth.DomainType, Object: id, ObjectType: auth.ThingType, @@ -467,7 +467,7 @@ func (svc service) DeleteClient(ctx context.Context, token, id string) error { } // Remove policy of users - if _, err := svc.auth.DeletePolicy(ctx, &magistrala.DeletePolicyReq{ + if _, err := svc.auth.DeletePolicyFilter(ctx, &magistrala.DeletePolicyFilterReq{ SubjectType: auth.UserType, Object: id, ObjectType: auth.ThingType, diff --git a/things/service_test.go b/things/service_test.go index 777b48ef53..b61b2eeaa2 100644 --- a/things/service_test.go +++ b/things/service_test.go @@ -1613,9 +1613,9 @@ func TestDeleteClient(t *testing.T) { token string identifyResponse *magistrala.IdentityRes authorizeResponse *magistrala.AuthorizeRes - deletePolicyResponse *magistrala.DeletePolicyRes - deletePolicyResponse1 *magistrala.DeletePolicyRes - deletePolicyResponse2 *magistrala.DeletePolicyRes + deletePolicyResponse *magistrala.DeletePolicyFilterRes + deletePolicyResponse1 *magistrala.DeletePolicyFilterRes + deletePolicyResponse2 *magistrala.DeletePolicyFilterRes clientID string identifyErr error authorizeErr error @@ -1632,9 +1632,9 @@ func TestDeleteClient(t *testing.T) { clientID: client.ID, identifyResponse: &magistrala.IdentityRes{Id: validID, DomainId: testsutil.GenerateUUID(t)}, authorizeResponse: &magistrala.AuthorizeRes{Authorized: true}, - deletePolicyResponse: &magistrala.DeletePolicyRes{Deleted: true}, - deletePolicyResponse1: &magistrala.DeletePolicyRes{Deleted: true}, - deletePolicyResponse2: &magistrala.DeletePolicyRes{Deleted: true}, + deletePolicyResponse: &magistrala.DeletePolicyFilterRes{Deleted: true}, + deletePolicyResponse1: &magistrala.DeletePolicyFilterRes{Deleted: true}, + deletePolicyResponse2: &magistrala.DeletePolicyFilterRes{Deleted: true}, err: nil, }, { @@ -1660,8 +1660,8 @@ func TestDeleteClient(t *testing.T) { clientID: client.ID, identifyResponse: &magistrala.IdentityRes{Id: validID, DomainId: testsutil.GenerateUUID(t)}, authorizeResponse: &magistrala.AuthorizeRes{Authorized: true}, - deletePolicyResponse: &magistrala.DeletePolicyRes{Deleted: true}, - deletePolicyResponse1: &magistrala.DeletePolicyRes{Deleted: true}, + deletePolicyResponse: &magistrala.DeletePolicyFilterRes{Deleted: true}, + deletePolicyResponse1: &magistrala.DeletePolicyFilterRes{Deleted: true}, deleteErr: repoerr.ErrRemoveEntity, err: repoerr.ErrRemoveEntity, }, @@ -1680,7 +1680,7 @@ func TestDeleteClient(t *testing.T) { clientID: client.ID, identifyResponse: &magistrala.IdentityRes{Id: validID, DomainId: testsutil.GenerateUUID(t)}, authorizeResponse: &magistrala.AuthorizeRes{Authorized: true}, - deletePolicyResponse: &magistrala.DeletePolicyRes{Deleted: false}, + deletePolicyResponse: &magistrala.DeletePolicyFilterRes{Deleted: false}, deletePolicyErr: errRemovePolicies, err: errRemovePolicies, }, @@ -1690,8 +1690,8 @@ func TestDeleteClient(t *testing.T) { clientID: client.ID, identifyResponse: &magistrala.IdentityRes{Id: validID, DomainId: testsutil.GenerateUUID(t)}, authorizeResponse: &magistrala.AuthorizeRes{Authorized: true}, - deletePolicyResponse: &magistrala.DeletePolicyRes{Deleted: true}, - deletePolicyResponse1: &magistrala.DeletePolicyRes{Deleted: false}, + deletePolicyResponse: &magistrala.DeletePolicyFilterRes{Deleted: true}, + deletePolicyResponse1: &magistrala.DeletePolicyFilterRes{Deleted: false}, deletePolicyErr1: errRemovePolicies, err: errRemovePolicies, }, @@ -1701,9 +1701,9 @@ func TestDeleteClient(t *testing.T) { clientID: client.ID, identifyResponse: &magistrala.IdentityRes{Id: validID, DomainId: testsutil.GenerateUUID(t)}, authorizeResponse: &magistrala.AuthorizeRes{Authorized: true}, - deletePolicyResponse: &magistrala.DeletePolicyRes{Deleted: true}, - deletePolicyResponse1: &magistrala.DeletePolicyRes{Deleted: true}, - deletePolicyResponse2: &magistrala.DeletePolicyRes{Deleted: false}, + deletePolicyResponse: &magistrala.DeletePolicyFilterRes{Deleted: true}, + deletePolicyResponse1: &magistrala.DeletePolicyFilterRes{Deleted: true}, + deletePolicyResponse2: &magistrala.DeletePolicyFilterRes{Deleted: false}, deletePolicyErr2: errRemovePolicies, err: errRemovePolicies, }, @@ -1713,18 +1713,18 @@ func TestDeleteClient(t *testing.T) { repoCall := auth.On("Identify", mock.Anything, &magistrala.IdentityReq{Token: tc.token}).Return(tc.identifyResponse, tc.identifyErr) repoCall1 := auth.On("Authorize", mock.Anything, mock.Anything).Return(tc.authorizeResponse, tc.authorizeErr) repoCall2 := cache.On("Remove", mock.Anything, tc.clientID).Return(tc.removeErr) - repoCall3 := auth.On("DeletePolicy", context.Background(), &magistrala.DeletePolicyReq{ + repoCall3 := auth.On("DeletePolicyFilter", context.Background(), &magistrala.DeletePolicyFilterReq{ SubjectType: authsvc.GroupType, Object: tc.clientID, ObjectType: authsvc.ThingType, }).Return(tc.deletePolicyResponse, tc.deletePolicyErr) - repoCall4 := auth.On("DeletePolicy", mock.Anything, &magistrala.DeletePolicyReq{ + repoCall4 := auth.On("DeletePolicyFilter", mock.Anything, &magistrala.DeletePolicyFilterReq{ SubjectType: authsvc.DomainType, Object: tc.clientID, ObjectType: authsvc.ThingType, }).Return(tc.deletePolicyResponse1, tc.deletePolicyErr1) repoCall5 := cRepo.On("Delete", context.Background(), tc.clientID).Return(tc.deleteErr) - repoCall6 := auth.On("DeletePolicy", mock.Anything, &magistrala.DeletePolicyReq{ + repoCall6 := auth.On("DeletePolicyFilter", mock.Anything, &magistrala.DeletePolicyFilterReq{ SubjectType: authsvc.UserType, Object: tc.clientID, ObjectType: authsvc.ThingType, diff --git a/things/standalone/standalone.go b/things/standalone/standalone.go index f9e5aabefc..13ea7b7c91 100644 --- a/things/standalone/standalone.go +++ b/things/standalone/standalone.go @@ -62,7 +62,7 @@ func (repo singleUserRepo) AddPolicies(ctx context.Context, in *magistrala.AddPo return nil, nil } -func (repo singleUserRepo) DeletePolicy(ctx context.Context, in *magistrala.DeletePolicyReq, opts ...grpc.CallOption) (*magistrala.DeletePolicyRes, error) { +func (repo singleUserRepo) DeletePolicyFilter(ctx context.Context, in *magistrala.DeletePolicyFilterReq, opts ...grpc.CallOption) (*magistrala.DeletePolicyFilterRes, error) { return nil, nil } diff --git a/users/service.go b/users/service.go index 76a176258a..cd026f4078 100644 --- a/users/service.go +++ b/users/service.go @@ -710,7 +710,7 @@ func (svc service) updateClientPolicy(ctx context.Context, userID string, role m case mgclients.UserRole: fallthrough default: - resp, err := svc.auth.DeletePolicy(ctx, &magistrala.DeletePolicyReq{ + resp, err := svc.auth.DeletePolicyFilter(ctx, &magistrala.DeletePolicyFilterReq{ SubjectType: auth.UserType, Subject: userID, Relation: auth.AdministratorRelation, diff --git a/users/service_test.go b/users/service_test.go index 55a20ac2ab..880f6e1f7e 100644 --- a/users/service_test.go +++ b/users/service_test.go @@ -998,25 +998,25 @@ func TestUpdateClientRole(t *testing.T) { } cases := []struct { - desc string - client mgclients.Client - identifyResponse *magistrala.IdentityRes - superAdminAuthReq *magistrala.AuthorizeReq - membershipAuthReq *magistrala.AuthorizeReq - superAdminAuthRes *magistrala.AuthorizeRes - membershipAuthRes *magistrala.AuthorizeRes - deletePolicyResponse *magistrala.DeletePolicyRes - addPolicyResponse *magistrala.AddPolicyRes - updateRoleResponse mgclients.Client - token string - identifyErr error - authorizeErr error - membershipAuthErr error - deletePolicyErr error - addPolicyErr error - updateRoleErr error - checkSuperAdminErr error - err error + desc string + client mgclients.Client + identifyResponse *magistrala.IdentityRes + superAdminAuthReq *magistrala.AuthorizeReq + membershipAuthReq *magistrala.AuthorizeReq + superAdminAuthRes *magistrala.AuthorizeRes + membershipAuthRes *magistrala.AuthorizeRes + deletePolicyFilterResponse *magistrala.DeletePolicyFilterRes + addPolicyResponse *magistrala.AddPolicyRes + updateRoleResponse mgclients.Client + token string + identifyErr error + authorizeErr error + membershipAuthErr error + deletePolicyErr error + addPolicyErr error + updateRoleErr error + checkSuperAdminErr error + err error }{ { desc: "update client role successfully", @@ -1088,75 +1088,75 @@ func TestUpdateClientRole(t *testing.T) { err: svcerr.ErrAddPolicies, }, { - desc: "update client role to user role successfully ", - client: client2, - identifyResponse: &magistrala.IdentityRes{UserId: client.ID}, - superAdminAuthReq: superAdminAuthReq, - superAdminAuthRes: &magistrala.AuthorizeRes{Authorized: true}, - membershipAuthReq: membershipAuthReq, - membershipAuthRes: &magistrala.AuthorizeRes{Authorized: true}, - deletePolicyResponse: &magistrala.DeletePolicyRes{Deleted: true}, - updateRoleResponse: client2, - token: validToken, - err: nil, + desc: "update client role to user role successfully ", + client: client2, + identifyResponse: &magistrala.IdentityRes{UserId: client.ID}, + superAdminAuthReq: superAdminAuthReq, + superAdminAuthRes: &magistrala.AuthorizeRes{Authorized: true}, + membershipAuthReq: membershipAuthReq, + membershipAuthRes: &magistrala.AuthorizeRes{Authorized: true}, + deletePolicyFilterResponse: &magistrala.DeletePolicyFilterRes{Deleted: true}, + updateRoleResponse: client2, + token: validToken, + err: nil, }, { - desc: "update client role to user role with failed to delete policy", - client: client2, - superAdminAuthReq: superAdminAuthReq, - identifyResponse: &magistrala.IdentityRes{UserId: client.ID}, - superAdminAuthRes: &magistrala.AuthorizeRes{Authorized: true}, - membershipAuthReq: membershipAuthReq, - membershipAuthRes: &magistrala.AuthorizeRes{Authorized: true}, - deletePolicyResponse: &magistrala.DeletePolicyRes{Deleted: false}, - updateRoleResponse: mgclients.Client{}, - token: validToken, - deletePolicyErr: svcerr.ErrAuthorization, - err: svcerr.ErrAuthorization, + desc: "update client role to user role with failed to delete policy", + client: client2, + superAdminAuthReq: superAdminAuthReq, + identifyResponse: &magistrala.IdentityRes{UserId: client.ID}, + superAdminAuthRes: &magistrala.AuthorizeRes{Authorized: true}, + membershipAuthReq: membershipAuthReq, + membershipAuthRes: &magistrala.AuthorizeRes{Authorized: true}, + deletePolicyFilterResponse: &magistrala.DeletePolicyFilterRes{Deleted: false}, + updateRoleResponse: mgclients.Client{}, + token: validToken, + deletePolicyErr: svcerr.ErrAuthorization, + err: svcerr.ErrAuthorization, }, { - desc: "update client role to user role with failed to delete policy with error", - client: client2, - identifyResponse: &magistrala.IdentityRes{UserId: client.ID}, - superAdminAuthReq: superAdminAuthReq, - superAdminAuthRes: &magistrala.AuthorizeRes{Authorized: true}, - membershipAuthReq: membershipAuthReq, - membershipAuthRes: &magistrala.AuthorizeRes{Authorized: true}, - deletePolicyResponse: &magistrala.DeletePolicyRes{Deleted: false}, - updateRoleResponse: mgclients.Client{}, - token: validToken, - deletePolicyErr: svcerr.ErrMalformedEntity, - err: svcerr.ErrDeletePolicies, + desc: "update client role to user role with failed to delete policy with error", + client: client2, + identifyResponse: &magistrala.IdentityRes{UserId: client.ID}, + superAdminAuthReq: superAdminAuthReq, + superAdminAuthRes: &magistrala.AuthorizeRes{Authorized: true}, + membershipAuthReq: membershipAuthReq, + membershipAuthRes: &magistrala.AuthorizeRes{Authorized: true}, + deletePolicyFilterResponse: &magistrala.DeletePolicyFilterRes{Deleted: false}, + updateRoleResponse: mgclients.Client{}, + token: validToken, + deletePolicyErr: svcerr.ErrMalformedEntity, + err: svcerr.ErrDeletePolicies, }, { - desc: "Update client with failed repo update and roll back", - client: client, - superAdminAuthReq: superAdminAuthReq, - identifyResponse: &magistrala.IdentityRes{UserId: client.ID}, - superAdminAuthRes: &magistrala.AuthorizeRes{Authorized: true}, - membershipAuthReq: membershipAuthReq, - membershipAuthRes: &magistrala.AuthorizeRes{Authorized: true}, - addPolicyResponse: &magistrala.AddPolicyRes{Added: true}, - deletePolicyResponse: &magistrala.DeletePolicyRes{Deleted: true}, - updateRoleResponse: mgclients.Client{}, - token: validToken, - updateRoleErr: svcerr.ErrAuthentication, - err: svcerr.ErrAuthentication, + desc: "Update client with failed repo update and roll back", + client: client, + superAdminAuthReq: superAdminAuthReq, + identifyResponse: &magistrala.IdentityRes{UserId: client.ID}, + superAdminAuthRes: &magistrala.AuthorizeRes{Authorized: true}, + membershipAuthReq: membershipAuthReq, + membershipAuthRes: &magistrala.AuthorizeRes{Authorized: true}, + addPolicyResponse: &magistrala.AddPolicyRes{Added: true}, + deletePolicyFilterResponse: &magistrala.DeletePolicyFilterRes{Deleted: true}, + updateRoleResponse: mgclients.Client{}, + token: validToken, + updateRoleErr: svcerr.ErrAuthentication, + err: svcerr.ErrAuthentication, }, { - desc: "Update client with failed repo update and failedroll back", - client: client, - identifyResponse: &magistrala.IdentityRes{UserId: client.ID}, - superAdminAuthReq: superAdminAuthReq, - superAdminAuthRes: &magistrala.AuthorizeRes{Authorized: true}, - membershipAuthReq: membershipAuthReq, - membershipAuthRes: &magistrala.AuthorizeRes{Authorized: true}, - addPolicyResponse: &magistrala.AddPolicyRes{Added: true}, - deletePolicyResponse: &magistrala.DeletePolicyRes{Deleted: false}, - updateRoleResponse: mgclients.Client{}, - token: validToken, - updateRoleErr: svcerr.ErrAuthentication, - err: svcerr.ErrAuthentication, + desc: "Update client with failed repo update and failedroll back", + client: client, + identifyResponse: &magistrala.IdentityRes{UserId: client.ID}, + superAdminAuthReq: superAdminAuthReq, + superAdminAuthRes: &magistrala.AuthorizeRes{Authorized: true}, + membershipAuthReq: membershipAuthReq, + membershipAuthRes: &magistrala.AuthorizeRes{Authorized: true}, + addPolicyResponse: &magistrala.AddPolicyRes{Added: true}, + deletePolicyFilterResponse: &magistrala.DeletePolicyFilterRes{Deleted: false}, + updateRoleResponse: mgclients.Client{}, + token: validToken, + updateRoleErr: svcerr.ErrAuthentication, + err: svcerr.ErrAuthentication, }, { desc: "update client role with failed MembershipPermission authorization", @@ -1178,7 +1178,7 @@ func TestUpdateClientRole(t *testing.T) { repoCall := cRepo.On("CheckSuperAdmin", context.Background(), mock.Anything).Return(tc.checkSuperAdminErr) authCall2 := auth.On("Authorize", context.Background(), tc.membershipAuthReq).Return(tc.membershipAuthRes, tc.membershipAuthErr) authCall3 := auth.On("AddPolicy", context.Background(), mock.Anything).Return(tc.addPolicyResponse, tc.addPolicyErr) - authCall4 := auth.On("DeletePolicy", context.Background(), mock.Anything).Return(tc.deletePolicyResponse, tc.deletePolicyErr) + authCall4 := auth.On("DeletePolicyFilter", context.Background(), mock.Anything).Return(tc.deletePolicyFilterResponse, tc.deletePolicyErr) repoCall1 := cRepo.On("UpdateRole", context.Background(), mock.Anything).Return(tc.updateRoleResponse, tc.updateRoleErr) updatedClient, err := svc.UpdateClientRole(context.Background(), tc.token, tc.client)