milvus-logo
LFAI
< Docs
  • RESTful

Grant Privilege To Role

POST
http://${MILVUS_URI}/v2/vectordb/roles/grant_privilege

This operation grants a privilege to the current role.

Notes

  • To complete this operation, you need to enable authentication on your Milvus instance. For details, refer to Authenticate User Access.
  • To learn more about the privileges and role objects, refer to Users & Roles

Example

export MILVUS_URI="localhost:19530"

curl --location --request POST "http://${MILVUS_URI}/v2/vectordb/roles/grant_privilege" \
--header "Content-Type: application/json" \
--data-raw '{
    "objectType": "Collection",
    "objectName": "*",
    "privilege": "Search",
    "roleName": "readOnly"
}'

Possible response is similar to the following.

{
    "code": 0,
    "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

{
    "roleName": "string",
    "objectType": "string",
    "objectName": "string",
    "privilege": "string"
}
ParameterDescription
roleName *string
The name of the role.
objectType *string
The type of the object to which the privilege belongs.
objectName *string
The name of the object to which the role is granted the specified privilege.
privilege *string
The privilege that is granted to the 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.
messagestring
Indicates the possible reason for the reported error.
dataobject
Feedback

Was this page helpful?