I need to develop an Ionic(phonegap)
app for Sales Team.
Basically the flow is :
creates a list on the smartphone
app.CouchDB
and sends a GCM push
to Shop Admin
I tried basic todo list with Cloudant.com and It's really fast. I need to know if I can implement Role Based Authentication? Am I on the right track here?
Thanks.
One option you could consider is having a database per sales rep. The sales rep databases could replicate back to a master database that would be accessed by the shop admin. You would need to cater for delays in replication between the sales rep database and the master database when altering the shop admin of the order with the GCM push.
For a discussion on having multiple databases per device user, see CouchDB - Separate database for each user?
The Cloudant TODO demo application is a native android application. If you want similar functionality from a javascript appplication, you can use pouchdb. The pouchdb replication documentation is here.
You can check the Chatty Couchapp Tutorial app from Smileupps App Store
It's a pure couchapp, relying on CouchDB only as its backend. The tutorial is still work in progress but the couchapp is fully working and you can download its source code.
It implements role/user based read/write ACLs using a single CouchDB database. This way you don't have to setup N replications where N depends on the number of your users. You only have one database containing all your data, easy to be queried on the fly(with temporary views) and for maintenance operations. Of course you can decide to increase the number of database, depending on type of your data and use cases.
A single couchapp contains all the necessary code for frontend, admin dashboard and server side API implementing business rules
The user, depending on his roles have different access to different sections. i.e. he can access the frontend website, but not the admin dashboard.
You can install the free trial, then download the source code with Smileupps deployment tools, change it, upload it and check your changes.