mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-30 02:48:45 +08:00
fix: fix ReadWrite privilege group deny all global API (#36145)
issue: #35471 pr: #36144 Signed-off-by: Wei Liu <wei.liu@zilliz.com>
This commit is contained in:
parent
13d443eb2e
commit
16daf9177f
@ -252,7 +252,7 @@ func collMatch(requestObj, policyObj string) bool {
|
||||
_, coll1 := funcutil.SplitObjectName(requestObj[strings.Index(requestObj, "-")+1:])
|
||||
_, coll2 := funcutil.SplitObjectName(policyObj[strings.Index(policyObj, "-")+1:])
|
||||
|
||||
return coll2 == util.AnyWord || coll1 == coll2
|
||||
return coll1 == util.AnyWord || coll2 == util.AnyWord || coll1 == coll2
|
||||
}
|
||||
|
||||
func PrivilegeGroupContains(args ...interface{}) (interface{}, error) {
|
||||
|
@ -417,6 +417,42 @@ func TestPrivilegeGroup(t *testing.T) {
|
||||
|
||||
_, err = PrivilegeInterceptor(GetContext(context.Background(), "fooo:123456"), &milvuspb.CreateResourceGroupRequest{})
|
||||
assert.Error(t, err)
|
||||
|
||||
_, err = PrivilegeInterceptor(GetContext(context.Background(), "fooo:123456"), &milvuspb.CreateAliasRequest{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
_, err = PrivilegeInterceptor(GetContext(context.Background(), "fooo:123456"), &milvuspb.DropAliasRequest{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
_, err = PrivilegeInterceptor(GetContext(context.Background(), "fooo:123456"), &milvuspb.DescribeAliasRequest{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
_, err = PrivilegeInterceptor(GetContext(context.Background(), "fooo:123456"), &milvuspb.CreateDatabaseRequest{})
|
||||
assert.Error(t, err)
|
||||
|
||||
_, err = PrivilegeInterceptor(GetContext(context.Background(), "fooo:123456"), &milvuspb.DropDatabaseRequest{})
|
||||
assert.Error(t, err)
|
||||
|
||||
_, err = PrivilegeInterceptor(GetContext(context.Background(), "fooo:123456"), &milvuspb.ListDatabasesRequest{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
_, err = PrivilegeInterceptor(GetContext(context.Background(), "fooo:123456"), &milvuspb.CreateCollectionRequest{})
|
||||
assert.Error(t, err)
|
||||
|
||||
_, err = PrivilegeInterceptor(GetContext(context.Background(), "fooo:123456"), &milvuspb.DropCollectionRequest{})
|
||||
assert.Error(t, err)
|
||||
|
||||
_, err = PrivilegeInterceptor(GetContext(context.Background(), "fooo:123456"), &milvuspb.DescribeCollectionRequest{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
_, err = PrivilegeInterceptor(GetContext(context.Background(), "fooo:123456"), &milvuspb.ShowCollectionsRequest{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
_, err = PrivilegeInterceptor(GetContext(context.Background(), "fooo:123456"), &milvuspb.RenameCollectionRequest{
|
||||
OldName: "coll1",
|
||||
NewName: "newName",
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
|
||||
t.Run("grant ReadWrite to all collection", func(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user