Hi,
I took a look around to see if maybe there is anything else besides permissions, relations and rel_segs that would make sense to be deleted automatically when deleting a group. I figure since Randy submitted a bug and patch for deleting groups, we might as well get as much of this handled now with that bug as possible!
I think there might be a few more items... here are the steps I think need to be done to delete a group.
- delete rel_constraints.required_rel_segment on this group
- delete permissions on group and all its rel_segs
- delete dependent constraints on group and it's rel_segs
(like rel_segments_delete tcl proc)
- delete relations to group and rel_segs
The 1st step is based on code I found from where a group is deleted from the admin page (packages/acs-subsite/www/admin/groups/delete-2.tcl
); group::delete
does an extra step before it calls application_group__delete
:
-- the acs_group package takes care of segments referred
-- to by rel_constraints.rel_segment. We delete the ones
-- references by rel_constraints.required_rel_segment here.
for row in (select cons.constraint_id
from rel_constraints cons, rel_segments segs
where segs.segment_id = cons.required_rel_segment
and segs.group_id = :group_id) loop
rel_segment.delete(row.constraint_id);
end loop;
Seems the tcl proc
group::delete
is the right/preferred way to delete app groups. It looks like an extra rel_constraint may be left lying around if I call pl/sql function
acs_group__delete
directly instead of tcl proc
group::delete
. Maybe this constraint is created for me when I create my app group (on it's relationship to the app group rel_type)? I think any constraints I might create on my rel_segments are deleted differently (like in
rel_segments_delete
)? I'm not sure about the constraint deletion here...
The 2nd I had to do or my call to acs_group__delete
would fail with ERROR: acs_permissions_grantee_id_fk referential integrity violation - key in parties still referenced from acs_permissions
I know I didn't create any rel_constraints on my group so I don't care about the 3rd... but might be a "bug" for someone else and cause acs_group__delete
to fail;(
Anyway, there is definitely more to deleting a group than what the current acs_group__delete does and it would be really helpful to get most of this done in Randy's patch to the proc so that it gets into the code base soon:) Can a core team developer let us know what the right things to do in this proc are?
For instance rel_types to the group or it's rel_segs would also need to be removed if they were created. But I don't think that's a good thing to do in acs_group__delete
itself since rel_types are reusable among groups and may not have been created strictly for use with a single group. I think deleting rel_types should be the creator's decision to explicitly delete.
And, just for the record, I am still able to drop my groups after I have added members to them too. I tried that today;)
Guidance from those who know on the final patch to acs_group__delete
?! thanks:)