content/operate/rs/security/access-control/create-db-roles.md
Roles with database access grant the ability to access and interact with a database's data. Database access privileges are determined by defining [Redis ACLs]({{<relref "/operate/rs/security/access-control/redis-acl-overview">}}) and adding them to roles.
To create a role that grants database access without granting access to the Redis Software Cluster Manager UI and REST API:
Define Redis ACLs that determine database access privileges.
Create a role with ACLs added and leave the Management role as None.
You can use the Cluster Manager UI or the REST API to define Redis ACL rules that you can assign to roles.
{{< multitabs id="define-redis-acls" tab1="Cluster Manager UI" tab2="REST API" >}}
To define a Redis ACL rule using the Cluster Manager UI:
From Access Control > Roles > Data ACLs, you can either:
Select an existing Redis ACL from the list to edit it.
Click + Add Redis ACL to create a new Redis ACL.
Enter a descriptive name for the Redis ACL. This will be used to associate the ACL rule with the role.
Define the ACL rule. For more information about Redis ACL rules and syntax, see the [Redis ACL overview]({{<relref "/operate/rs/security/access-control/redis-acl-overview">}}).
Click Save.
-tab-sep-
To define a Redis ACL rule using the REST API, use a [create Redis ACL]({{<relref "/operate/rs/references/rest-api/requests/redis_acls#post-redis_acl">}}) request. For more information about Redis ACL rules and syntax, see the [Redis ACL overview]({{<relref "/operate/rs/security/access-control/redis-acl-overview">}}).
Example request:
POST /v1/redis_acls
{
"name": "Test_ACL_1",
"acl": "+@read +FT.INFO +FT.SEARCH"
}
Example response body:
{
"acl": "+@read +FT.INFO +FT.SEARCH",
"name": "Test_ACL_1",
"uid": 11
}
To associate the Redis ACL with a role and database, use the uid from the response as the redis_acl_uid when you add roles_permissions to the database.
{{< /multitabs >}}
{{<note>}}
For multi-key commands on multi-slot keys, the return value is failure, but the command runs on the keys that are allowed.
{{</note>}}
To create a role that grants database access to users but blocks access to the Redis Software Cluster Manager UI and REST API, set the Management role to None.
{{< multitabs id="create-db-roles" tab1="Cluster Manager UI" tab2="REST API" >}}
To define a role for database access using the Cluster Manager UI:
From Access Control > Roles, you can:
Select a role from the list of existing roles to edit it.
Click + Add role to create a new role.
Enter a descriptive name for the role. This will be used to reference the role when configuring users.
Leave Management role as the default None.
Click + Add ACL.
Choose a Redis ACL and databases to associate with the role.
Click the check mark to confirm.
Click Save.
-tab-sep-
To define a role for database access using the REST API:
Use a [create role]({{<relref "/operate/rs/references/rest-api/requests/roles#post-role">}}) request:
POST /v1/roles
{
"name": "<role-name>",
"management": "none"
}
Example response body:
{
"management": "none",
"name": "<role-name>",
"uid": 7
}
To associate the role with a Redis ACL and database, use the uid from the response as the role_uid when you add roles_permissions to the database.
[Update a database's configuration]({{<relref "/operate/rs/references/rest-api/requests/bdbs#put-bdbs">}}) to add roles_permissions with the role and Redis ACL:
POST /v1/bdbs/<database-id>
{
"roles_permissions":
[
{
"role_uid": <integer>,
"redis_acl_uid": <integer>
}
]
}
{{< /multitabs >}}
You can [assign the new role to users]({{<relref "/operate/rs/security/access-control/create-users#assign-roles-to-users">}}) to grant database access.