From 8f46a2095762785ee3cde295ebdd42609d2644fd Mon Sep 17 00:00:00 2001 From: SimFG Date: Wed, 29 May 2024 20:51:44 +0800 Subject: [PATCH] fix: show empty collection when has granted the all privilege (#33445) - issue: #33382 Signed-off-by: SimFG --- internal/rootcoord/show_collection_task.go | 2 +- internal/rootcoord/show_collection_task_test.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/rootcoord/show_collection_task.go b/internal/rootcoord/show_collection_task.go index 247a171af3..090d4ada5b 100644 --- a/internal/rootcoord/show_collection_task.go +++ b/internal/rootcoord/show_collection_task.go @@ -89,7 +89,7 @@ func (t *showCollectionTask) Execute(ctx context.Context) error { for _, entity := range entities { objectType := entity.GetObject().GetName() if objectType == commonpb.ObjectType_Global.String() && - entity.GetGrantor().GetPrivilege().GetName() == commonpb.ObjectPrivilege_PrivilegeAll.String() { + entity.GetGrantor().GetPrivilege().GetName() == util.PrivilegeNameForAPI(commonpb.ObjectPrivilege_PrivilegeAll.String()) { privilegeColls.Insert(util.AnyWord) return privilegeColls, nil } diff --git a/internal/rootcoord/show_collection_task_test.go b/internal/rootcoord/show_collection_task_test.go index 8d82e4aa20..52cea062cb 100644 --- a/internal/rootcoord/show_collection_task_test.go +++ b/internal/rootcoord/show_collection_task_test.go @@ -298,7 +298,9 @@ func TestShowCollectionsAuth(t *testing.T) { { Object: &milvuspb.ObjectEntity{Name: commonpb.ObjectType_Global.String()}, Grantor: &milvuspb.GrantorEntity{ - Privilege: &milvuspb.PrivilegeEntity{Name: commonpb.ObjectPrivilege_PrivilegeAll.String()}, + Privilege: &milvuspb.PrivilegeEntity{ + Name: util.PrivilegeNameForAPI(commonpb.ObjectPrivilege_PrivilegeAll.String()), + }, }, }, }, nil).Once()