Skip to content

Commit

Permalink
fix: RBAC fix privilege group orm (milvus-io#2366)
Browse files Browse the repository at this point in the history
issue: milvus-io/milvus#37031

Signed-off-by: shaoting-huang <shaoting.huang@zilliz.com>
  • Loading branch information
shaoting-huang committed Nov 21, 2024
1 parent 47cd95e commit 0c55e38
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions pymilvus/orm/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)

0 comments on commit 0c55e38

Please sign in to comment.