Sync Gateway Authorization


#1

Hey guys, i am developing an android application for resturants. So i have 3 roles, waiter,chef and admin. Each role have access to difference document. I have read the couchbase developer guides and understand most of it. However, i need some clarification in the process of how defining a role works.

Example, Jane is a waiter, Tom is a chef and jack is admin. Each of them have to login into the application with their account and i validate from there. So how do i even create accounts for them, where should i store them and how to assign roles to their name.

A side question just for clarity sake,
“sync”:function (doc) { channel (doc.channels); },

The doc.channels is referring the value of key “channels” in the specific document?

Thank you:)


#2

Use the Sync Gateway admin REST API to create and manage users & roles.

Roles are just a way to let sets of users share privileges. You don’t have to use them if you don’t need to.

Yes, doc.channels refers to the channels property (since this is JavaScript.)


#3

There are some introductory details in the Sync Gateway Authorization guide on the user and role API calls Jens mentions:

http://developer.couchbase.com/documentation/mobile/1.2/develop/guides/sync-gateway/administering-sync-gateway/authorizing-users/index.html