To run the app, open the folder for the platform of your choice (android, dotnet or ios) and follow the instructions in the respective README.
-
Start Sync Gateway with the configuration file in the root of this project.
~/Downloads/couchbase-sync-gateway/bin/sync_gateway sync-gateway-config.json
-
Add lists and tasks and they should be visible on the Sync Gateway Admin UI on http://localhost:4985/_admin/.
The configuration file creates a few users by default. Users with the moderator role can:
- Update/delete any user's list.
- Have access to all the lists in the system.
- Can invite any number of users to a list.
The role created in Sync Gateway enforces security in the Sync Function. Couchbase Lite on the other hand can't tell if the user is a moderator. For that reason, the app uses another document of type "moderator" to detect the user's status and permissions. The "moderator" document can be created through the Admin REST API with the following.
curl -X POST 'http://localhost:4985/todo/' \
-H 'Content-Type: application/json' \
-d '{"_id": "moderator.mod", "type": "moderator", "username": "mod"}'