revoke_role()
This operation revokes the role assigned to a user.
Request syntax
revoke_role(
user_name: str,
role_name: str,
timeout: Optional[float] = None
) -> None
PARAMETERS:
-
user_name (str) -
[REQUIRED]
The name of an existing user.
-
role_name (str) -
[REQUIRED]
The name of the role to revoke.
-
timeout (float | None)
The timeout duration for this operation.
Setting this to None indicates that this operation timeouts when any response arrives or any error occurs.
RETURN TYPE:
NoneType
RETURNS:
None
EXCEPTIONS:
-
MilvusException
This exception will be raised when any error occurs during this operation.
-
BaseException
This exception will be raised when this operation fails.
Example
from pymilvus import MilvusClient
# 1. Create a milvus client
client = MilvusClient(
uri="https://inxx-xxxxxxxxxxxx.api.gcp-us-west1.zillizcloud.com:19530",
token="user:password"
)
# 2. Create a user
client.create_user(user_name="user_1", password="P@ssw0rd")
# 3. Grant the role to the user
client.grant_role(user_name="user_1", role_name="db_ro")
# 4. Revoke the role from the user
client.revoke_role(user_name="user_1", role_name="db_ro")