In the collection “A” settings there is a field in the relationships that allows me to choos if the relationship is “read only” or not. I set the relationship as NOT “read only”.
And in the role settings I have the following settings:
I’d like to be able to “delete” this record, but I’d like to inhibit the “disassociate the relationship” feature. Is it possible to remove the “disassociate” option?
Your questions are perfectly clear.
Unfortunately, there is no way today to do what you’re trying to achieve (the other way around is possible though - having the “dissociate” without the “delete” for instance).
I’m pushing a request to our Product board so that it can be tackled in the future.
Thanks again for your feedback and sorry for the inconvenience.
Hi Forest.
Any update about this from your product board?
Is this covered in the new @forestadmin/agent?
Thank you,
Matteo
@morganperre I’m tagging you here because you liked the previous answer and the Forest Guy who answered me in march 2023 is now “anon###” so maybe at the moment he’s not a Forest Guy any more
Unfortunately, we did have done anything regarding this.
Though, you can disable dissociation while maintaining delete by combining role permission Delete and Update (but not sure you don’t want to allow Updates). Dissociate is only available when having both permissions (which make sense since dissociating is only an update).
As you pointed-out something on the frontend I’m not sure to understand.
For sure you could do something on the agent side to throw and forbids it manually using a hook before update.
Let me know if the workaround is enough for you. In the meanwhile I will re forward the feedback to the product team.
Thank you @morganperre
We can’t manage this thing with roles, as the roles we need will allow both Delete and Disassociate… that’s our point
With the legacy forest express sequelize, we managed this with a number of route overrides (one for each relationship where we needed to prevent Disassociate) and we’re now migrating to the new agent, so I was wondering if we had to do the same with a before update hook
Hi @morganperre
We’re not able to do what you suggest.
We set up the relationship (A) as “read only” in the collection B
We allowed the collection B delete permission
But now we can both:
delete B
disassociate B
Maybe I’m missing something… don’t know
By the way, since we’re migrating to the new agent @forestadmin/agent, it would be very nice if, in the deleteOverride function, you tell in the context if the function call comes from a delete or a disassociate (i.e. understanding the http route where the function call comes from…).
in the past I’m pretty sure that you used to send an http POST in this case. not a DELETE!!! How is this possible?!? Did you change something?
We created (about 1.5 years ago) a complex mechanism (with route overrides) to prevent the disassociate on our side, by overriding the involved routes and allowing updates (POST to the relationship route) only if there is a create (POST in the “B” route) at most 3 seconds before.
Now we just realized that this does not work any more!! Because you are now disassociating through a DELETE to the relationship route!
@jeffladiray you recently told us that in the new agent @forestadmin/agent everything about the disassociate passes through the deleteOverride (in the new agent).
But I’m really sure that previously you sent a POST (not a DELETE) the the relationship route to disassociate.
May you please confirm that you changed this behaviour? Or am I allucinating??
I’m a little bit disappointed. I tried it on my side and it was working. From where did you try to delete or dissociate ? (related data (has many relation) or the belongsTo)
Maybe you need to do the read only trick on both side depending on how you navigate your data.
Nevertheless, this is not ideal and I have shared your feedback to the team. I will ping them again to emphase the issue.
We did release the ability to hide “Dissociate the relationship” action. You can now hide at the team level that default action, for a relationship they don’t want to dissociate.