silverstripe/silverstripe-framework — pull request #2962 by kmayo-ss (2014-03-17 01:30:50+00:00)
Title: Admin removal warning

This pull request is to resolve CMS Issue 730

silverstripe/silverstripe-cms#730

It works by adding a warning popup when a admin removes the admin option from the DirectGroups listbox on their own profile.
Member::getCMSField has had a check added where if a admin is modifying there own profile a hidden field called removeAdminWarning is added containing there admin groups.
SecurityAdmin.js has been modified so if if any changes are made to DirectGroups it checks the field removeAdminWarning to see if the admin permissions are being removed and if they are a warning is produced.

A unit test has been included for this however this relies on a pull request for the SilverStripe Behat extension which adds 2 new steps.

silverstripe-labs/silverstripe-behat-extension#21

It may be worth considering dropping the unit test or refactoring it to use existing behat functions however I did look into this and could not find a way to achieve this with existing functionality however the following pull request does seem to suggest it could be done differently

https://github.com/silverstripe-labs/silverstripe-behat-extension/pull/27