I am trying to make a decision either use (static)channels as filter at mobile side or dynamically update user channels using admin proxy API.
consider a case where Super Entity --> has many sub entities
and each sub entity --> has many child entities
There are many argument made like security aspects of it etc.
If User has access to super entity it means it has access to all sub level entities; but user can choose at what level he/she wants to work; which means User can choose to download or work on few child entities at time or few sub entities.
In order to do that Application must handle aforesaid situation. In order to achieve this, two approaches are advised
superEntity channels are [superEntity-1] where 1 is id (format of channel is [superEntity-{ID}])
child entity channels are [childEntity -1] where is 1 is child entity id (format of channel is [childEntity-{ID}])
- Use (static)channels as filter at mobile side, Application logic will determine what channels should be passed into pull request (we are keeping channels as some sort of patterns, it can be built in dynamically based on Id and type)
List channels = new ArrayList();
channels.add("superEntity-1"); channels.add("superEntity-2"); pull.setChannels(channels);
In order to download child entity
List channels = new ArrayList();
channels.add("childEntity-1"); channels.add("childEntity-2"); pull.setChannels(channels);
- Dynamically update user channels using admin proxy API.
Mobile will consume a proxy sync gateway admin API and let couchbase server know it’s intention that now user wants to download childEntity-1 and childEntity-2; therefore; Admin proxy API will update user channels; returns OK response to mobile. Now mobile can initiate pull/push request.
Both sounds good idea and doable; however, I need to make sure, it remains less volatile at client and server side and security aspects must be covered.
I would appreciate if you could some good insight on it.