March 16, 2025
+ 12

How to verify Sync Gateway access to data in cloud-to-edge enterprise data synchronization.

Related topics: Create Role | Create User | Add Role to User | Allow Access | Verify Access | Write Access

Related Concepts

Access control Model

Purpose

Use the Admin REST API to see the:

  • Channels a user has access to

  • Channels a role has access to

  • Channels a document is assigned to

Context

The all_channels property of a user account determines the channels a user can access. Its value is derived from the union of:

  • The user’s admin_channels property, which is set using the Admin REST API.

  • The channels the user has been granted access to by access() calls from sync functions invoked for current revisions of documents.

  • The all_channels properties of any roles the user belongs to. These are themselves computed using the above rules.

Process

Send a get request to the /{tkn-db}/_user/{name} endpoint

bash
curl http://localhost:4985/db/_user/pupshaw

The output shows that the user pupshaw has access to the following channels:

1 all through its own admin_channels setting
2 hoopy through the froods role’s admin_channels setting
json
{ "admin_channels": [ "all" (1) ], "admin_roles": [ "froods" ], "all_channels": [ "all", "hoopy" (2) ], "name": "pupshaw", "roles": [ "froods" ] }