MJoin - Providing list of linked records to delete
MJoin - Providing list of linked records to delete
Hi @allan ,
As per the MJoin
specification, it currently deletes every link before recreating them in the database (both on one-to-many and many-to-many relationships).
Sometimes, it is still needed to avoid that behaviour if for example, the user editing the data doesn't have access to all of it.
Example:
- let's assume a user has access to specific data based on their permissions through specific user roles.
- If we have 2 users who can edit some data with different access level, it could lead to a loss of data
Let's say we want user A to upload and attach a document to a record R. This document should only be seen by user A and user B. Now, we have user C uploading a new document to the same record R. If using the uploadMany, it will delete the link between the first document and the record R as it is not part of the list of documents user C can see on the client-side (therefore, not present in the data shared between client and server).
What I would suggest would be to allow the MJoin class method Remove to use a specific optional parameter that would list the "deleted" items that would've been manually deleted by the user on the client-side. Preventing the need to delete and recreate all links between the tables (and allowing to update linked data with different access permission).
I hope it is clear enough, but if not don't hesitate to ask for more detail.
Best regards,
Vincent.
Answers
Hi Vincent,
Many thanks for your feedback! I agree with your line of reasoning and in fact adding something similar to what you suggest is on the cards for Editor 2.1 (basically a
where
condition for the Mjoined link table). I don't yet have a release schedule for Editor 2.1 yet is the only thing... Most likely before the end of the year.Allan
Hi Allan,
That's great to hear
I hope it'll be available in the coming months.
Best regards,
Vincent.