1

I need to develop an Ionic(phonegap) app for Sales Team. Basically the flow is :

  • Sales Reps go to a client
  • client gives order of products and quantity of each.
  • Sales rep creates a list on the smartphone app.
  • app syncs data with CouchDB and sends a GCM push to Shop Admin
  • Admin processes the order manually

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.

Tejas
  • 2,215
  • 2
  • 18
  • 27
  • Are you trying to prevent sales reps from seeing other sales rep orders, and do you want the shop admin to see all orders? – Chris Snow Mar 18 '15 at 14:49
  • Yes, that's what i want. Is this stack right for my app? – Tejas Mar 18 '15 at 16:52
  • Which TODO demo application did you try? There are a few, e.g. [pouchDB](http://pouchdb.com/getting-started.html) and [cloudant android](https://github.com/cloudant/sync-android/tree/master/sample/todo-sync) – Chris Snow Mar 19 '15 at 05:37
  • I tried this http://pouchdb.com/getting-started.html. Trying to find example with advance tasks like auth. Thanks. – Tejas Mar 19 '15 at 06:25

2 Answers2

0

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 Is it good practice to give each CouchDB user a separate database?

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.

Community
  • 1
  • 1
Chris Snow
  • 23,813
  • 35
  • 144
  • 309
0

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.

giowild
  • 479
  • 5
  • 17