From 0c55e38976c2a4d587c6163c4cb45bc24de30c6f Mon Sep 17 00:00:00 2001 From: sthuang <167743503+shaoting-huang@users.noreply.github.com> Date: Wed, 20 Nov 2024 23:08:25 +0800 Subject: [PATCH] fix: RBAC fix privilege group orm (#2366) issue: https://github.com/milvus-io/milvus/issues/37031 Signed-off-by: shaoting-huang --- pymilvus/orm/role.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/pymilvus/orm/role.py b/pymilvus/orm/role.py index 66c68dd77..989ef8c73 100644 --- a/pymilvus/orm/role.py +++ b/pymilvus/orm/role.py @@ -272,9 +272,9 @@ def create_privilege_group(self, privilege_group: str): >>> from pymilvus.orm.role import Role >>> connections.connect() >>> role = Role(role_name) - >>> role.create_privilege_group(privilege_group) + >>> role.create_privilege_group(privilege_group="privilege_group") """ - return self._get_connection().create_privilege_group(self._name, privilege_group) + return self._get_connection().create_privilege_group(privilege_group) def drop_privilege_group(self, privilege_group: str): """Drop a privilege group for the role @@ -286,9 +286,9 @@ def drop_privilege_group(self, privilege_group: str): >>> from pymilvus.orm.role import Role >>> connections.connect() >>> role = Role(role_name) - >>> role.drop_privilege_group(privilege_group) + >>> role.drop_privilege_group(privilege_group="privilege_group") """ - return self._get_connection().drop_privilege_group(self._name, privilege_group) + return self._get_connection().drop_privilege_group(privilege_group) def list_privilege_groups(self): """List all privilege groups for the role @@ -305,7 +305,7 @@ def list_privilege_groups(self): >>> role = Role(role_name) >>> role.list_privilege_groups() """ - return self._get_connection().list_privilege_groups(self._name) + return self._get_connection().list_privilege_groups() def add_privileges_to_group(self, privilege_group: str, privileges: list): """Add privileges to a privilege group for the role @@ -319,11 +319,10 @@ def add_privileges_to_group(self, privilege_group: str, privileges: list): >>> from pymilvus.orm.role import Role >>> connections.connect() >>> role = Role(role_name) - >>> role.add_privileges_to_group(privilege_group, ["Insert", "Select"]) + >>> role.add_privileges_to_group(privilege_group="privilege_group", + >>> privileges=["Insert","Select"]) """ - return self._get_connection().add_privileges_to_group( - self._name, privilege_group, privileges - ) + return self._get_connection().add_privileges_to_group(privilege_group, privileges) def remove_privileges_from_group(self, privilege_group: str, privileges: list): """Remove privileges from a privilege group for the role @@ -337,8 +336,7 @@ def remove_privileges_from_group(self, privilege_group: str, privileges: list): >>> from pymilvus.orm.role import Role >>> connections.connect() >>> role = Role(role_name) - >>> role.remove_privileges_from_group(privilege_group, ["Insert", "Select"]) + >>> role.remove_privileges_from_group(privilege_group="privilege_group", + >>> privileges=["Insert","Select"]) """ - return self._get_connection().remove_privileges_from_group( - self._name, privilege_group, privileges - ) + return self._get_connection().remove_privileges_from_group(privilege_group, privileges)