I’m trying to figure out the best way to apply write permission to a collection.
Say i have a collection ‘CarAd’:
I use the partition ‘car=public’, and everyone has read-rights because i want everyone to be able to se my CarAd.
I don’t want anyone but the creator of the CarAd to be able to edit the data…
I’ve tried toying around triggers and functions, but have not been succesfull.
So my question is:
Is there anyway to determine if a user has write-rights based on another field value - say ‘creator_id’ or such?
I realize that i could create two collection types with different names, and use a trigger to copy inserted object into the public realm, but i would like to avoid the redundancy and it just seems wrong somehow.
I think i found the answer here (or at least a solution that will do):
I’ll accept redundancy, and copy object to public realm with a new id. When updating the object, i’ll use a trigger to update the object in the public realm.