You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RS: Add REST API examples for creating & associating roles and ACLs with databases (#1024)
* DOC-4175 RS: Added REST API examples for creating & associating roles and ACLs with databases
* DOC-4175 RS: Add more REST API examples for role & ACL creation
Copy file name to clipboardExpand all lines: content/operate/rs/security/access-control/create-cluster-roles.md
+17-1Lines changed: 17 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -49,7 +49,11 @@ Here's a summary of the Cluster Manager UI actions permitted by each default man
49
49
50
50
## Create roles for cluster access {#create-cluster-role}
51
51
52
-
To create a role that grants cluster access but does not grant access to any databases:
52
+
You can use the [Cluster Manager UI](#create-roles-ui) or the [REST API](#define-roles-rest-api) to create a role that grants cluster access but does not grant access to any databases.
53
+
54
+
### Cluster Manager UI method {#create-roles-ui}
55
+
56
+
To create a role that grants cluster access:
53
57
54
58
1. From **Access Control** > **Roles**, you can:
55
59
@@ -70,3 +74,15 @@ To create a role that grants cluster access but does not grant access to any dat
70
74
1. Select **Save**.
71
75
72
76
You can [assign the new role to users]({{<relref "/operate/rs/security/access-control/create-users#assign-roles-to-users">}}) to grant cluster access.
77
+
78
+
### REST API method {#define-roles-rest-api}
79
+
80
+
To [create a role]({{<relref "/operate/rs/references/rest-api/requests/roles#post-role">}}) that grants cluster access:
Copy file name to clipboardExpand all lines: content/operate/rs/security/access-control/create-combined-roles.md
+86-2Lines changed: 86 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,11 @@ To create a role that grants database access privileges and allows access to the
18
18
19
19
## Define Redis ACLs
20
20
21
-
To define a Redis ACL rule that you can assign to a role:
21
+
You can use the [Cluster Manager UI](#define-acls-ui) or the [REST API](#define-acls-rest-api) to define Redis ACL rules that you can assign to roles.
22
+
23
+
### Cluster Manager UI method {#define-acls-ui}
24
+
25
+
To define a Redis ACL rule using the Cluster Manager UI:
22
26
23
27
1. From **Access Control > Redis ACLs**, you can either:
24
28
@@ -40,9 +44,39 @@ The **ACL builder** does not support selectors and key permissions. Use **Free t
40
44
For multi-key commands on multi-slot keys, the return value is `failure`, but the command runs on the keys that are allowed.
41
45
{{</note>}}
42
46
47
+
### REST API method {#define-acls-rest-api}
48
+
49
+
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">}}).
50
+
51
+
Example request:
52
+
53
+
```sh
54
+
POST /v1/redis_acls
55
+
{
56
+
"name": "Test_ACL_1",
57
+
"acl": "+@read +FT.INFO +FT.SEARCH"
58
+
}
59
+
```
60
+
61
+
Example response body:
62
+
63
+
```json
64
+
{
65
+
"acl": "+@read +FT.INFO +FT.SEARCH",
66
+
"name": "Test_ACL_1",
67
+
"uid": 11
68
+
}
69
+
```
70
+
71
+
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. See [Associate a database with roles and Redis ACLs](#associate-roles-acls-rest-api) for an example request.
72
+
43
73
## Create roles with ACLs and cluster access {#create-role}
44
74
45
-
To create a role that grants database access privileges and allows access to the Cluster Management UI and REST API:
75
+
You can create a role that grants database access privileges and allows access to the Cluster Management UI and REST API.
76
+
77
+
### Cluster Manager UI method {#create-roles-ui}
78
+
79
+
To define a role for combined access using the Cluster Manager UI:
46
80
47
81
1. From **Access Control** > **Roles**, you can:
48
82
@@ -73,3 +107,53 @@ To create a role that grants database access privileges and allows access to the
73
107
{{<imagefilename="images/rs/screenshots/access-control/rbac-save-combined-role.png"alt="Add databases to access">}}
74
108
75
109
You can [assign the new role to users]({{<relref "/operate/rs/security/access-control/create-users#assign-roles-to-users">}}) to grant database access and access to the Cluster Manager UI and REST API.
110
+
111
+
### REST API method {#define-roles-rest-api}
112
+
113
+
To define a role for combined access using the REST API:
114
+
115
+
1.[Create a role.](#create-role-rest-api)
116
+
117
+
1.[Associate a database with roles and Redis ACLs.](#associate-roles-acls-rest-api)
118
+
119
+
#### Create a role {#create-role-rest-api}
120
+
121
+
To [create a role]({{<relref "/operate/rs/references/rest-api/requests/roles#post-role">}}) using the REST API:
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. See [Associate a database with roles and Redis ACLs](#associate-roles-acls-rest-api) for an example request.
142
+
143
+
144
+
#### Associate a database with roles and Redis ACLs {#associate-roles-acls-rest-api}
145
+
146
+
[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:
Copy file name to clipboardExpand all lines: content/operate/rs/security/access-control/create-db-roles.md
+84-2Lines changed: 84 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,11 @@ To create a role that grants database access without granting access to the Redi
20
20
21
21
## Define Redis ACLs
22
22
23
-
To define a Redis ACL rule that you can assign to a role:
23
+
You can use the [Cluster Manager UI](#define-acls-ui) or the [REST API](#define-acls-rest-api) to define Redis ACL rules that you can assign to roles.
24
+
25
+
### Cluster Manager UI method {#define-acls-ui}
26
+
27
+
To define a Redis ACL rule using the Cluster Manager UI:
24
28
25
29
1. From **Access Control > Redis ACLs**, you can either:
26
30
@@ -42,11 +46,39 @@ The **ACL builder** does not support selectors and key permissions. Use **Free t
42
46
For multi-key commands on multi-slot keys, the return value is `failure`, but the command runs on the keys that are allowed.
43
47
{{</note>}}
44
48
49
+
### REST API method {#define-acls-rest-api}
50
+
51
+
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">}}).
52
+
53
+
Example request:
54
+
55
+
```sh
56
+
POST /v1/redis_acls
57
+
{
58
+
"name": "Test_ACL_1",
59
+
"acl": "+@read +FT.INFO +FT.SEARCH"
60
+
}
61
+
```
62
+
63
+
Example response body:
64
+
65
+
```json
66
+
{
67
+
"acl": "+@read +FT.INFO +FT.SEARCH",
68
+
"name": "Test_ACL_1",
69
+
"uid": 11
70
+
}
71
+
```
72
+
73
+
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. See [Associate a database with roles and Redis ACLs](#associate-roles-acls-rest-api) for an example request.
74
+
45
75
## Create roles with ACLs
46
76
47
77
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**.
48
78
49
-
To define a role for database access:
79
+
### Cluster Manager UI method {#create-roles-ui}
80
+
81
+
To define a role for database access using the Cluster Manager UI:
50
82
51
83
1. From **Access Control** > **Roles**, you can:
52
84
@@ -77,3 +109,53 @@ To define a role for database access:
77
109
{{<imagefilename="images/rs/access-control-role-save.png"alt="Add databases to access" >}}
78
110
79
111
You can [assign the new role to users]({{<relref "/operate/rs/security/access-control/create-users#assign-roles-to-users">}}) to grant database access.
112
+
113
+
### REST API method {#define-roles-rest-api}
114
+
115
+
To define a role for database access using the REST API:
116
+
117
+
1.[Create a role.](#create-role-rest-api)
118
+
119
+
1.[Associate a database with roles and Redis ACLs.](#associate-roles-acls-rest-api)
120
+
121
+
#### Create a role {#create-role-rest-api}
122
+
123
+
To [create a role]({{<relref "/operate/rs/references/rest-api/requests/roles#post-role">}}) using the REST API:
124
+
125
+
```sh
126
+
POST /v1/roles
127
+
{
128
+
"name": "<role-name>",
129
+
"management": "none"
130
+
}
131
+
```
132
+
133
+
Example response body:
134
+
135
+
```json
136
+
{
137
+
"management": "none",
138
+
"name": "<role-name>",
139
+
"uid": 7
140
+
}
141
+
```
142
+
143
+
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. See [Associate a database with roles and Redis ACLs](#associate-roles-acls-rest-api) for an example request.
144
+
145
+
146
+
#### Associate a database with roles and Redis ACLs {#associate-roles-acls-rest-api}
147
+
148
+
[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:
0 commit comments