milvus-logo
LFAI
< Docs
  • RESTful

Grant Role To User

POST
http://${MILVUS_URI}/v2/vectordb/users/grant_role

This operation grants a specified role to the current user. Once granted the role, the user gets permissions allowed for the current role and can perform certain operations.

Notes To complete this operation, you need to enable authentication on your Milvus instance. For details, refer to Authenticate User Access.

Example

export MILVUS_URI="localhost:19530"

curl --location --request POST "http://${MILVUS_URI}/v2/vectordb/users/grant_role" \
--header "Content-Type: application/json" \
--data-raw '{
    "roleName": "admin",
    "userName": "milvusAdmin"
}'

Possible response is similar to the following :

{
    "code": 200,
    "data": {}
}

Request

Parameters

  • Header parameters

    ParameterDescription
    Request-Timeoutinteger
    The timeout duration for this operation.
    Setting this to None indicates that this operation timeouts when any response arrives or any error occurs.
    Authorizationstring
    The authentication token.
  • No query parameters required

  • No path parameters required

Request Body

{
    "userName": "string",
    "roleName": "string"
}
ParameterDescription
userName *string
The name of the target user. The value should start with a letter and can only contain underline, letters and numbers.
roleName *string
The name of the target role.

Response

None

Response Bodies

  • Response body if we process your request successfully
{
    "code": "integer",
    "data": {}
}
  • Response body if we failed to process your request
{
    "code": integer,
    "message": string
}

Properties

The properties in the returned response are listed in the following table.

PropertyDescription
codeinteger
Indicates whether the request succeeds.
  • 200: The request succeeds.
  • Others: Some error occurs.
dataobject
messagestring
Indicates the possible reason for the reported error.
Feedback

Was this page helpful?