"realms://...";
final Realm managementRealm = user.getManagementRealm();
try {
final PermissionChange permissionChange = new PermissionChange(
realmUrl,
"*", // for all users
true, // read
false, // write
false // manage
);
managementRealm.insert(permissionChange);
} finally {
managementRealm.close();
}