< Docs
  • Java


A MilvusClient interface. This method revokes the privileges granted to the current role.

Note: Revokes privileges of a specified role.
R<RpcStatus> revokeRolePrivilege(RevokeRolePrivilegeParam requestParam);


Use the RevokeRolePrivilegeParam.Builder to construct a RevokeRolePrivilegeParam object.

import io.milvus.param.RevokeRolePrivilegeParam;
RevokeRolePrivilegeParam.Builder builder = RevokeRolePrivilegeParam.newBuilder();

Methods of RevokeRolePrivilegeParam.Builder:

withRoleName(String roleName)Sets the role name.
The role name cannot be empty or null.
roleName: The role name.
withObject(String object)Sets the object.
The object cannot be empty or null.
object: A granted object in Milvus, such as collection, partition, and database.
withObjectName(String objectName)Sets the object name. The object name cannot be empty or null.objectName: The object name.
withPrivilege(String privilege)Sets the privilege. The privilege cannot be empty or null.privilege: A concrete permission for accessing some object.

For details on applicable objects and privileges, refer to Users and Roles.

The can throw the following exceptions:

  • ParamException: error if the parameter is invalid.


This method catches all the exceptions and returns an R object.

  • If the API fails on the server side, it returns an error code and an error message.
  • If the API fails due to RPC exceptions, it returns R.Status.Unknown and error message of the exception.
  • If the API succeeds, it returns R.Status.Success.


import io.milvus.param.GrantRolePrivilegeParam;

R<RpcStatus> response = client.revokeRolePrivilege(RevokeRolePrivilegeParam.newBuilder()

if (response.getStatus() != R.Status.Success.getCode()) {
    throw new RuntimeException(response.getMessage());