Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Deleting security groups


Go to End


1506 Views

Avatar
thejackel

Community Member, 33 Posts

5 August 2008 at 2:46am

The security section seems to be slightly sketchy when deleting groups.

One problem I have noticed is when you select to delete a group what contains child groups, if you DON'T highlight each child group (select the checkbox so the group becomes a solid colour, rather than a light gray), the group will not be deleted from the database.

I've modified the javascript slightly so when a parent group is selected, ALL children are now automatically highlighted and assigned a delete action.

If anyone else has had this problem, feel free to use the code below as a workaround (its been tested for one branch but no more).

1. Open cms\javascript\SecurityAdmin_left.js

2. Go to the deletegroup object and insert the following lines below the if(sel && sel.className.indexOf('nodelete') == -1) { } block:

// NEW: Added to highlight child groups automatically
var children = sel.getElementsByTagName('li');
for(var i=0; i<children.length; i++)
{
var selIdx = $('sitetree').getIdxOf(children);
deletegroup.selectedNodes[selIdx] = true;
children.addNodeClass('selected');
}

This will basically highlight the child groups and assign the delete group method so the groups are deleted properly.

This issue also seems to affect users within the groups (if a group contains users, they are removed from the security section but still exist in the members table?!).

If i determine a quick fix for this I'll post it up.