Skip to content

Commit c3bd010

Browse files
committed
DOC-4175 RS: Added REST API examples for creating & associating roles and ACLs with databases
1 parent 7d33611 commit c3bd010

File tree

1 file changed

+47
-2
lines changed

1 file changed

+47
-2
lines changed

content/operate/rs/security/access-control/create-db-roles.md

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ To create a role that grants database access without granting access to the Redi
2020

2121
## Define Redis ACLs
2222

23-
To define a Redis ACL rule that you can assign to a role:
23+
### Cluster Manager UI method
24+
25+
To define a Redis ACL rule that you can assign to a role using the Cluster Manager UI:
2426

2527
1. From **Access Control > Redis ACLs**, you can either:
2628

@@ -42,11 +44,25 @@ The **ACL builder** does not support selectors and key permissions. Use **Free t
4244
For multi-key commands on multi-slot keys, the return value is `failure`, but the command runs on the keys that are allowed.
4345
{{</note>}}
4446

47+
### REST API method
48+
49+
To define a Redis ACL rule that you can assign to a role using the REST API:
50+
51+
```sh
52+
POST /v1/redis_acls
53+
{
54+
"name": "Test_ACL_1",
55+
"acl": "+@read +FT.INFO +FT.SEARCH"
56+
}
57+
```
58+
4559
## Create roles with ACLs
4660

4761
To create a role that grants database access to users but blocks access to the Redis Enterprise Cluster Manager UI and REST API, set the **Cluster management role** to **None**.
4862

49-
To define a role for database access:
63+
### Cluster Manager UI method
64+
65+
To define a role for database access using the Cluster Manager UI:
5066

5167
1. From **Access Control** > **Roles**, you can:
5268

@@ -77,3 +93,32 @@ To define a role for database access:
7793
{{<image filename="images/rs/access-control-role-save.png" alt="Add databases to access" >}}
7894

7995
You can [assign the new role to users]({{<relref "/operate/rs/security/access-control/create-users#assign-roles-to-users">}}) to grant database access.
96+
97+
### REST API method
98+
99+
To define a role for database access using the REST API:
100+
101+
1. Create role:
102+
103+
```sh
104+
POST /v1/roles
105+
{
106+
"name": "<role-name>",
107+
"management": "none"
108+
}
109+
```
110+
111+
1. Associate the role with ACLs and databases:
112+
113+
```sh
114+
POST /v1/bdbs/<database-id>
115+
{
116+
"roles_permissions":
117+
[
118+
{
119+
"role_uid": <integer>,
120+
"redis_acl_uid": <integer>
121+
}
122+
]
123+
}
124+
```

0 commit comments

Comments
 (0)