I’m setting up an app based on the documentation. My setup is simple :
- Use Default Realm (realm.cloud)
- Have one Class (ToDo)
- Control visibility access to ToDos based on permissions field.
If I do everything as the docs recommends :
let person = getPerson() // Create a new permission object for the user's private role and // add it to the objects permissions let permissions = person.permissions.findOrCreate(forRole: user.role) permissions.canRead = true permissions.canUpdate = true permissions.canDelete = true permissions.canSetPermissions = true
The app ends up creating a new __Permission object for every ToDo (or Person in the code above). This results in lots of wasted data, not to mention a single ToDo.delete() doesn’t remove the associated permission, so maintenance would be additional effort.
My question is : Is this the expected behavior? Is there something wrong in the sample code? Ideally I’d have one (or few based on permissions) __Permission object per user, which would be linked with all the ToDo’s.