User Management(RBAC)¶
Get a list of users belonging to the given instance database¶
GET mongodb/<instance_id>/databases/<database_name>/users
Response:
{
"data": [
{
"name": "myuser",
"roles": [
{
"role": "readWrite",
"db": "test"
},
{
"role": "dbAdmin",
"db": "test"
}
]
}
]
}
Create a new user in the specified instance database¶
POST mongodb/<instance_id>/databases/<database_name>/users
Request:
{
"username": "new_user",
"password": "mypassword",
"roles": [
{
"role": "read",
"db": "test"
},
{
"role": "readWrite",
"db": "test"
}
]
}
Response:
{
"data": "Successfully added user to instance."
}
Update an existing user’s password or role in a specific instance database¶
PATCH /mongodb/<instance_id>/databases/<database_name>/users/<username>
Request:
{
"password": "changed_password",
"roles": [
{
"role": "read",
"db": "test"
},
{
"role": "dbAdmin",
"db": "admin"
}
]
}
Response:
{
"message": "Successfully updated user details."
}
Note
You can update either the password or roles, or both. If a field is not provided (e.g., roles), it will remain unchanged.
Delete an existing user from a specific instance database¶
DELETE /mongodb/<instance_id>/databases/<database_name>/users/<username>
Response:
{
"data": "Successfully deleted User \"name of the user\" from Database \"name of the database\"."
}