A newer version of this documentation is available.

View Latest

Access Control Configuration

      +
      Pre-3.0 Legacy Configuration Equivalents

      This content describes configuration for Sync Gateway 3.0 and higher — for legacy configuration, see: Legacy Pre-3.0 Configuration

      Upsert Sync Function

      The sync function is crucial to the security of your application. It is in charge of data validation, access control and routing. The function executes every time a new revision/update is made to a document.

      https:://{sgw-uri}/{db}/_config/sync

      Use this convenience endpoint to add or update the Sync function for an existing Sync Gateway database

      See the 'Model' below for more info

      Sync Gateway Roles Required (CBS 7.0.2 Developer Preview):

      • Sync Gateway Architect

      Use this convenience endpoint to add or update the Sync function for an existing Sync Gateway database

      See the 'Model' below for more info

      Sync Gateway Roles Required (CBS 7.0.2 Developer Preview):

      • Sync Gateway Architect

      For more on the Sync Function and access control see: Sync Function Overview

      Parameters

      Type Name Description Schema

      Path

      db
      required

      Database name

      string

      Body

      sync function
      required

      The Javascipt code for the sync function

      Sync_model

      Type Name Description Schema

      Path

      db
      required

      Database name

      string

      Body

      sync function
      required

      The Javascipt code for the sync function

      Sync_model

      Responses

      HTTP Code Description Schema

      200

      OK

      Sync_model

      401

      401 - Unauthorized - Error validating credentials

      No Content

      HTTP Code Description Schema

      200

      OK

      Sync_model

      401

      401 - Unauthorized - Error validating credentials

      No Content

      Schema

      This section shows Sync Gateway’s access control configuration settings in schema format for convenience in constructing JSON models for use in the Admin REST API.

      The configuration settings described here are provisioned through the Access Control endpoints.

      Sync_model

      The sync property is a Javascript function that determines which users can access which documents.

      This JavaScript function is provisioned using the Admin Rest API Endpoint put /{db}/_config/sync

      Add the function as plain javascript in the request body, with the content-Type: application/javascript header.

      Type : string