Delete subnodes of other users inside a collection (by collection owner)

Is that possible to somehow delete the subnodes inside a collection node when the collection gets deleted? As I can see the subnodes will not be deleted but put inside the root “folder” of the pubsub service. But why is it done so or how is it possible to delete the subnodes created by other users inside this collection, because otherwise the root folder gets polluted after some collection deletions. Is there some configuration variable for that or a way to do that? I think it will be a very useful feature…

There are 3 recommended options under the spec for handling this use case. The first two are the simplest, but leaving nodes as orphans makes it impossible to find them via discovery, thus the second, which is the current Openfire behaviour you have described makes a better option.

This was probably why it was chosen. I think there are a myriad of problems with the cascading delete option, one of which is the one you mentioned regarding node ownership. I would guess that this is why it was not implemented, especially since the spec doesn’t go into any implementation detail as to how it should work.

Due to this lack of detail in the spec, I don’t think this option will be implemented any time soon, if ever.

Very sad! Could you give me a code hint how to customize to the third option? I think it’s a matter of a simple sql “DELETE” statement, right? :slight_smile:

If you want to customize, I would recommend you do the delete from within the code that processes the delete of the node at the service level by parsing through the children and deleting them as well, otherwise you are going to be out of sync with the db. Not to mention this will take care of a clustered situation as well.

That being said, doing it this way will mean multiple transactions in the db, which has its own issues.

Thanks! I’m actually not into the implentation of openfire, but I thought of the appropriate 2-3 lines of code :slight_smile: Or is it a way more?