Forum OpenACS Development: Re: Cannot delete groups with segments and rels

Posted by Andrew Piskorski on
I don't think I understand where the "cascaded deletes" in question are coming from here, I don't see any mentioned of them above. But when it comes to bug 234, of course a cascaded delete there won't do the right thing, it can't. AFAIK the only proper way there has ever been to delete an acs_object is by calling acs_object.delete() on the row. Properly, any core helper objects, like permissions, should also be deleted when acs_object.delete() is called, which is what the patch for that bug fixed, basically by just doing "delete from acs_permissions where object_id = v_object_id".

If you want "on delete cascade" to Do the Right Thing in general with acs_objects (perhaps a worthwhile goal...), that's a different and larger issue. AFAIK it is currently not supported by the OpenACS object system.

On the the deleting groups problem above, yup, sounds to me like a similar patch needs to be made there. It's the other end of the same problem actually, when you delete an acs_object you need to delete the permissions granted on that object. Likewise when you delete a group which has permissions on some object, you need to delete those granted permissions before deleting the group too...