milvus-logo
LFAI
< Docs
  • Java

removeUserFromRole()

MilvusClient interface. This method removes a user from a role. The user will remove permissions that the role is allowed to perform operations.

R<RpcStatus> removeUserFromRole(RemoveUserFromRoleParam requestParam);

RemoveUserFromRoleParam

Use the RemoveUserFromRoleParam.Builder to construct a RemoveUserFromRoleParam object.

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

Methods of AddUserToRoleParam.Builder:

Method Description Parameters
withRoleName(String roleName) Sets the roleName. RoleName cannot be empty or null. roleName: The role name used to create the privilege.
withUsername(String username) Sets the username. Username cannot be empty or null. username: The user name.
build() Construct a RemoveUserFromRoleParam object. N/A

The RemoveUserFromRoleParam.Builder.build() can throw the following exceptions:

  • ParamException: error if the parameter is invalid.

Returns

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

  • If the API fails on the server side, it returns the error code and message from the server.

  • If the API fails by RPC exception, it returns R.Status.Unknown and error message of the exception.

  • If the API succeeds, it returns R.Status.Success.

Example

import io.milvus.param.AddUserToRoleParam;

R<RpcStatus> response = client.removeUserFromRole(AddUserToRoleParam.newBuilder()
            .withRoleName(roleName)
            .withUserName(userName)
            .build());

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