fix: show empty collection when has granted the all privilege (#33445)

- issue: #33382

Signed-off-by: SimFG <bang.fu@zilliz.com>
pull/33458/head
SimFG 2024-05-29 20:51:44 +08:00 committed by GitHub
parent 54797b4286
commit 8f46a20957
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -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
}

View File

@ -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()