Realm Blog

Realm ObjC & Swift 2.9: Set Permissions Based On Usernames, User Info Lookup & Bug Fixes!

We’re releasing version 2.9 of Realm Objective‑C and Realm Swift today. In this release, we’re introducing a way to set permissions based on usernames, a way for administrators to retrieve user information from a Realm Object Server, various improvements, and applying a few bug fixes to keep your apps running strong.

Set Permissions Via Username

It’s now possible to set user permissions based on a user’s username, if they were registered using the Realm Object Server’s built-in username authentication system.

let permission = SyncPermissionValue(realmPath: realmPath,
                                     username: "[email protected]",
                                     accessLevel: .write)
user.applyPermission(permission) { error in
  // ...

Retrieving User Info

Administrator users can now look up the information of users on the Realm Object Server. If an administrator knows a user’s username, they can look up their Realm Object Server identity, which can be used to perform further administrative tasks.

let targetUserIdentity = "[email protected]"
adminUser.retrieveInfo(forUser: targetUserIdentity, identityProvider: .usernamePassword) { (userInfo, error) in
  guard let userInfo = userInfo else {
  print("The user's ROS identity is \(userInfo.identity)")

Sync User Improvements

It is now possible to create and log in multiple Realm Object Server users with the same identity if they originate from different servers. Note that if the URLs are different aliases for the same server each user will still be treated as separate (for example, they will each have their own copy of any synchronized Realm).

If you are creating users using the administrator token, we strongly recommend you specify an authentication server URL when calling the logIn() method. This server URL will become mandatory in a future release for all user types.

Other Enhancements

  • Performance for instantiating Swift objects containing at least one List property has been improved.

Bug Fixes

  • List.description now reports the correct types for nested lists.
  • Unmanaged object initialization when a nested property type returns false from Object.shouldIncludeInDefaultSchema() now works properly.
  • RLMArrays are no longer cleared on self-assignment.

Thanks for reading. Now go forth and build amazing apps with Realm! As always, we’re around on the Realm Forums, Stack Overflow, GitHub, or Twitter.

Realm Team

At Realm, our mission is to help developers build better apps faster. We provide a unique set of tools and platform technologies designed to make it easy for developers to build apps with sophisticated, powerful features — things like realtime collaboration, augmented reality, live data synchronization, offline experiences, messaging, and more.

Everything we build is developed with an eye toward enabling developers for what we believe the mobile internet evolves into — an open network of billions of users and trillions of devices, and realtime interactivity across them all.

Get more development news like this