android - How to create private RealmObjects in a shared Realm -


my goal pretty simple: need create private realmobjects in shared realm.

i created objects , stored them in shared realm. give users ability store objects privately though. far know have 2 ways accomplish this, none of them working.

solution 1: using permissions let users share realm objects each other in following sample:

public static void setactiveuser(final syncuser user) {         if (user.isvalid()) {             syncconfiguration defaultconfig = new syncconfiguration.builder(user, colombo.server_url).build();             realm.setdefaultconfiguration(defaultconfig);             realm realm = user.getmanagementrealm();             realm.executetransaction(new realm.transaction() {                 @override                 public void execute(realm realm) {                     string includeall = "*";                         change = new permissionchange(includeall, includeall, true, true, false);                         realm.insert(change);                 }             });         }     } 

unfortunately doesn't work, synchronized realms visibile current syncuser.

solution 2: create "common" syncuser save/show public items , private syncuser each registered user collect private items, switching common private syncuser depending on needs. anyway seems quite inefficient me. how sound you? think there's way can it?

you cannot use realm's authentication mechanism provide different login permissions different accounts single realm.

as nabil said, can programmatically control access assigning uuids users, , querying them per user.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -