@@ -33,13 +33,36 @@ Admin REST API::
3333NOTE: This is the default recommended option starting 3.0.
3434
3535Create 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
7497This method is convenient for testing and to get started. +
7598Use 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