Correct way to create new Realms users on Realm Object Server with permissions

I am trying to use the Realm Mobile platform to determine if it is suitable for an upcoming project.

I am using a server admin user to log into my sample application and by providing different paths in an object SyncConfiguration

, I can create different Realms, locally and on the object server.

    String realmUrl = String.format("realm://%1$s:%2$s/my_realm_name", OBJECT_SERVER_IP, BASE_PORT);
    SyncConfiguration syncConfiguration = new SyncConfiguration.Builder(SyncUser.currentUser(), realmUrl).build();
    Realm realm = Realm.getInstance(syncConfiguration);

      

The problem is that when I access the web panel, it seems that the administrator does not own the Realms he created using the client application.
So my question is, what's the best way for a user to create N owned Realms that can be shared with other users by managing access permissions?

+3


source to share


1 answer


When Realm files are opened for the first time, the SDK sends a request for an access token to the authentication service on the Realm Object Server. This will search if a file already exists in that path and create it if not. Files created there will be available only if they are located in the current user area. The easiest way to achieve this is if users create the files themselves.



as user ID "userA":
  /~/my_realm_name     => /userA/my_realm_name => owned
  /userA/my_realm_name => /userA/my_realm_name => owned
  /userB/my_realm_name => fails (no permissions)
  /my_realm_name       => fails (no permissions)

as user ID "admin" with administrator privileges:
  /~/my_realm_name     => /admin/my_realm_name => owned
  /userA/my_realm_name => /userA/my_realm_name => unowned
  /userB/my_realm_name => /userA/my_realm_name => unowned
  /my_realm_name       => /my_realm_name       => unowned

      

+2


source







All Articles