Authors can edit all posts, except when an owner is specified?

Actually I got it, just needed some simple logic.

If the post has an “owner” (the only person that can edit the post) I manually set the custom field “owned” to 1 and the author as the one that can edit.

On the edit post page (I’m doing it front-end) I check if “owned” custom field is = 1 and the author is = current user then I show the edit form. If not, I display a message. If the custom field “owned” is = 0, then I display the edit form so everyone can edit.