-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathexample_request.py
More file actions
20 lines (16 loc) · 1.09 KB
/
example_request.py
File metadata and controls
20 lines (16 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# section: code
from ibmcloudant.cloudant_v1 import CloudantV1, SecurityObject
service = CloudantV1.new_instance()
members = SecurityObject(
names=['user1', 'user2'],
roles=['developers']
)
response = service.put_security(
db='products',
members=members
).get_result()
print(response)
# section: markdown
# The `nobody` username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but didn't identify itself, the task can continue only if the `nobody` user has the role `_reader`.
# section: markdown
# If instead of using Cloudant's security model for managing permissions you opt to use the Apache CouchDB `_users` database (that is using legacy credentials _and_ the `couchdb_auth_only:true` option) then be aware that the user must already exist in `_users` database before adding permissions. For information on the `_users` database, see <a href="https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-work-with-your-account#using-the-users-database-with-cloudant-nosql-db" target="_blank">Using the `_users` database with Cloudant</a>.