Skip to content

Commit 90025da

Browse files
authored
Doc 13345 improve user/role documentation (#886)
* updated the data security page * updated the users page * updated urls and formated code snippets
1 parent 3c49617 commit 90025da

File tree

3 files changed

+288
-27
lines changed

3 files changed

+288
-27
lines changed

modules/ROOT/pages/_partials/howto/how-to-create-roles.adoc

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,16 @@ Admin REST API::
3939
+
4040
--
4141

42-
NOTE: This is the default recommended option starting 3.0..
4342

4443
Create a new role using the {rest-api-admin-role-post--xref} endpoint.
4544

4645
[source,bash]
4746
----
4847
$ curl -vX POST "http://localhost:4985/mydatabase/_roles/" -H
4948
"accept: application/json" -H "Content-Type: application/json" -d
50-
'{"name": "Edge1", "collection_acces": {"scopename": {"collectionname": {"admin_channels": ["channel1", "channel3"]]}}}}' // <.>
49+
'{"name":"Edge1","collection_access":{"scopename":{"collectionname":{"admin_channels":["channel1","channel3"]}}}}' // <.>
5150
----
52-
<.> Here we add the Edge1 role which grants channel access to channel1 and channel3 in scope scopename and collection collectionname.
51+
<.> Here you add the Edge1 role which grants channel access to channel1 and channel3 in scope `scopename` and collection `collectionname`.
5352

5453
--
5554

@@ -61,7 +60,7 @@ include::partial$block-caveats.adoc[tags=disable-persistent-cinfig]
6160

6261
Create roles by hardcoding them in the {configuration-properties-legacy--xref}.
6362
This method is convenient for testing and to get started.
64-
It is recommended to use the *REST API* for production systems.
63+
It is recommended to use the {rest-api-admin-role-post--xref} for production systems.
6564

6665
[source,json]
6766
----
@@ -77,8 +76,16 @@ It is recommended to use the *REST API* for production systems.
7776
}
7877
}
7978
}
80-
},
81-
"Edge2": {"admin_channels": ["channel2", "channel3"]},
79+
},
80+
"Edge2": {
81+
"collection_access": {
82+
"anotherscopename": {
83+
"anothercollectionname": {
84+
"admin_channels": ["channel2", "channel3"]
85+
}
86+
}
87+
}
88+
},
8289
"GUEST": {"disabled": true}
8390
}
8491
}

modules/ROOT/pages/_partials/howto/how-to-create-users.adoc

Lines changed: 78 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,36 @@ Admin REST API::
3333
NOTE: This is the default recommended option starting 3.0.
3434

3535
Create a new user by sending a POST request to the Admin Rest Api `_user` endpoint ({rest-api-admin-user-post--xref}).
36-
Update existing users by sending a PUT instead; in this case include the user name at the end of the url.
36+
Update existing users by sending a PUT request ({rest-api-admin-user-put--xref}); in this case include the user name at the end of the url.
3737

38-
The user credentials (**username**/**password**) are passed in the request body.
38+
---
39+
Using Named collections::
40+
+
41+
---
42+
43+
[source,bash]
44+
----
45+
$ curl -vX POST "http://localhost:4985/mydatabase/_user/" -H \
46+
"accept: application/json" -H "Content-Type: application/json" -d \
47+
'{"name":"Edge1User","password":"pass","collection_access":{"scopename":{"collectionname":{"admin_channels":["RandomChannel"]}}}}' // <.>
48+
49+
$ curl -vX PUT "http://localhost:4985/mydatabase/_user/Edge1User" -H \
50+
"accept: application/json" -H "Content-Type: application/json" -d \
51+
'{"name": "Edge1User", "collection_access": {"scopename": {"collectionname": {"admin_channels": ["RandomChannel"]}}}}' // <.>
52+
----
53+
54+
<.> Add new user "Edge1User" with collection-aware channel access to `scopename.collectionname`
55+
<.> Update existing user "Edge1User" and add `collection_access` data for named collections
56+
57+
58+
---
59+
Using default collection::
60+
+
61+
---
3962

4063
[source,bash]
4164
----
42-
$ curl -vX POST "http://localhost:4985/mydatabase/_user/" -H
65+
curl -vX POST "http://localhost:4985/mydatabase/_user/" -H
4366
"accept: application/json" -H "Content-Type: application/json" -d
4467
'{"name": "Edge1User", "password": "pass"}' // <.>
4568
@@ -74,16 +97,64 @@ Create users by hardcoding their credentials in the Configuration Properties fil
7497
This method is convenient for testing and to get started. +
7598
Use the Admin REST API for production system changes.
7699

100+
[#{tabs}]
101+
======
102+
103+
Using named collections::
104+
+
105+
---
106+
107+
[source,json]
108+
----
109+
{
110+
"databases": {
111+
"mydatabase": {
112+
"users": {. // <.>
113+
"GUEST": {
114+
"disabled": true
115+
},
116+
"Edge1User": {
117+
"password": "pass", // <.>
118+
"collection_access": {
119+
"scopename": {
120+
"collectionname": {
121+
"admin_channels": [
122+
"RandomChannel"
123+
]
124+
}
125+
}
126+
}
127+
}
128+
}
129+
}
130+
}
131+
}
132+
----
133+
134+
<.> {configuration-schema-database--pfx--db}-users[databases.$db.users]
135+
<.> Here we add the Edge1 user with access to channel `RandomChannel` in the scope `scopename` and collection `collectionname`.
136+
137+
---
138+
139+
Using default collection::
140+
+
141+
---
77142
78143
[source,json]
79144
----
80145
{
81146
"databases": {
82147
"mydatabase": {
83-
"users": { // <.>
84-
"GUEST": {"disabled": true},
85-
"Edge1User": {"password": "pass", // <.>
86-
"admin_channels": ["RandomChannel"]},
148+
"users": {. //<.>
149+
"GUEST": {
150+
"disabled": true
151+
},
152+
"Edge1User": {
153+
"password": "pass", // <.>
154+
"admin_channels": [
155+
"RandomChannel"
156+
]
157+
}
87158
}
88159
}
89160
}

0 commit comments

Comments
 (0)