mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-08 18:18:30 +08:00
fix: fix ReadWrite privilege group deny all global API (#36144)
issue: #35471 Signed-off-by: Wei Liu <wei.liu@zilliz.com>
This commit is contained in:
parent
c6eb6c7cb2
commit
06a706e5f0
@ -252,7 +252,7 @@ func collMatch(requestObj, policyObj string) bool {
|
|||||||
_, coll1 := funcutil.SplitObjectName(requestObj[strings.Index(requestObj, "-")+1:])
|
_, coll1 := funcutil.SplitObjectName(requestObj[strings.Index(requestObj, "-")+1:])
|
||||||
_, coll2 := funcutil.SplitObjectName(policyObj[strings.Index(policyObj, "-")+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) {
|
func PrivilegeGroupContains(args ...interface{}) (interface{}, error) {
|
||||||
|
|||||||
@ -417,6 +417,42 @@ func TestPrivilegeGroup(t *testing.T) {
|
|||||||
|
|
||||||
_, err = PrivilegeInterceptor(GetContext(context.Background(), "fooo:123456"), &milvuspb.CreateResourceGroupRequest{})
|
_, err = PrivilegeInterceptor(GetContext(context.Background(), "fooo:123456"), &milvuspb.CreateResourceGroupRequest{})
|
||||||
assert.Error(t, err)
|
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) {
|
t.Run("grant ReadWrite to all collection", func(t *testing.T) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user