Start a new topic

Determine if user can edit entity

Hi, I'm looking for the proper way to see if the current user can edit an entity. I've come up with:



~~~

var user = Kinvey.getActiveUser();

if(user._id === entity._acl.creator){

//user is owner

}

~~~



But I'm guessing this won't work if there are user groups or reader/writer lists. Is there a method available to determine what permission level a user has for an entity?



Titanium v 1.1.8



Thanks


`new Kinvey.Acl(entity).getCreator()` returns the same as entity._acl.creator, so I'm assuming that if I want to get anyone who is the creator or a writer for the entity, I'll need to do both `getCreator()` and `getWriters()` for the entity. Either that or add the creator as a writer.
That would work yes. However, if the user is part of a group that has read/write access, there is no way to check write access without actually firing the request.
Login or Signup to post a comment